I am trying to extract the text before matching a certain word ("METROS") and I'm struggling with the line break ("\n"). I only want to ignore the first line break before my match (not the second).
Any suggestions?
Raw Text: DATOS DEL LUGAR \n MIDE UNA SUPERFICIE DE CINCUENTA Y \n NUEVE METROS CUADRADOS.
Text I want: MIDE UNA SUPERFICIE DE CINCUENTA Y NUEVE
Regex I am using:
([^\\n{1}]\n.*)(?=METROS)
My result until now: Y NUEVE
Thank you in advance!
Try this (^.*\n?.*)(?=METROS)
Please remove ?
after '\n' if there will be always a newline before METROS
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加