How can I ignore the first line break for a Positive Lookahead (regex)

Pedro LC

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!

Rugnar

Try this (^.*\n?.*)(?=METROS)

Please remove ? after '\n' if there will be always a newline before METROS

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

how can I ignore nested patterns with regex

分類Dev

How can I add a line break to a list of lists?

分類Dev

How can I make new line or break in array?

分類Dev

Print only first matching line of regex and ignore other matches

分類Dev

How can I remove the first whitespace of every line of a file?

分類Dev

How can I make no line space using regex?

分類Dev

Can I read the rest of the line after a positive value of IOSTAT?

分類Dev

.NET Regex lookahead custom line continuation

分類Dev

Can I make the text in the button to use line break

分類Dev

Combining positive and negative lookahead

分類Dev

How can I move to a new line the last word of a <h1> sentence on mobile, and in desktop mode break the sentence in 3 lines?

分類Dev

How can I make IBus not ignore ~/.XCompose?

分類Dev

How can we break two words into separate line?

分類Dev

How can I add a code to copy the first line of excel sheet and paste it on new email body

分類Dev

How to ignore brackets in a regex

分類Dev

Regex replace Windows line break characters

分類Dev

Regex Ignore First 6 Matches Of Character

分類Dev

How can I break only long words in IE?

分類Dev

RESOLVED: how can i break a for loop based on a response from promise?

分類Dev

How to add a line break in JavaScript?

分類Dev

How do I make a numeric negative/positive range from -47 to 1123 in Regex?

分類Dev

How can I ignore Lorem Ipsum text from my Spellchecker?

分類Dev

How can I ignore previous selection and write only last selected

分類Dev

how can i remove the first forward slash?

分類Dev

How can I use regex wildcard in assertion?

分類Dev

How can I make this cases match with regex?

分類Dev

How can I apply padding to the end of a line?

分類Dev

negative lookahead regex on elasticsearch

分類Dev

regex lookahead assertion

Related 関連記事

  1. 1

    how can I ignore nested patterns with regex

  2. 2

    How can I add a line break to a list of lists?

  3. 3

    How can I make new line or break in array?

  4. 4

    Print only first matching line of regex and ignore other matches

  5. 5

    How can I remove the first whitespace of every line of a file?

  6. 6

    How can I make no line space using regex?

  7. 7

    Can I read the rest of the line after a positive value of IOSTAT?

  8. 8

    .NET Regex lookahead custom line continuation

  9. 9

    Can I make the text in the button to use line break

  10. 10

    Combining positive and negative lookahead

  11. 11

    How can I move to a new line the last word of a <h1> sentence on mobile, and in desktop mode break the sentence in 3 lines?

  12. 12

    How can I make IBus not ignore ~/.XCompose?

  13. 13

    How can we break two words into separate line?

  14. 14

    How can I add a code to copy the first line of excel sheet and paste it on new email body

  15. 15

    How to ignore brackets in a regex

  16. 16

    Regex replace Windows line break characters

  17. 17

    Regex Ignore First 6 Matches Of Character

  18. 18

    How can I break only long words in IE?

  19. 19

    RESOLVED: how can i break a for loop based on a response from promise?

  20. 20

    How to add a line break in JavaScript?

  21. 21

    How do I make a numeric negative/positive range from -47 to 1123 in Regex?

  22. 22

    How can I ignore Lorem Ipsum text from my Spellchecker?

  23. 23

    How can I ignore previous selection and write only last selected

  24. 24

    how can i remove the first forward slash?

  25. 25

    How can I use regex wildcard in assertion?

  26. 26

    How can I make this cases match with regex?

  27. 27

    How can I apply padding to the end of a line?

  28. 28

    negative lookahead regex on elasticsearch

  29. 29

    regex lookahead assertion

ホットタグ

アーカイブ