How to match two lines separated by newline?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

How to match two lines separated by newline? Tue Oct 04, 2022 4:44 am • by halloleo
I have a PDF whose textual representation (according to the rules preview) contains the two lines

Code: Select all
...
 1 Mar 21
 28 Mar 21
...

I can match the individual lines, but I don't know how to match the two lines with the newline in between.

Also, each date seems to start always on the second column of the line (note the space before 1 Mar 21). Can I somehow say in a match: "Match from the beginning of the line a space and then my custom text"?

Thanks for pointers! :)
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

If you enter a space in to a pattern, it will match any amount of space or newlines.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:If you enter a space in to a pattern, it will match any amount of space or newlines.


Thanks Paul.

To find with more certainty the intended match, is there a way to specify to match only newlines and not other whitespace?
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

Not really. Is that really needed in this case? You can try matching a specific occurrence if it's something that occurs multiple times in the file. Or match the line before and/or after to include more context.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron