Regex Match for newline/carriagereturn

Been having issues regex matching carriage return or new line.

When I extract text from PDF, I am not able to match double new line e.g

text = " word

what I need 35 blah blah"

Regex.Match(text,"(?<=word[\r\n]{2})[A-z ]+(?=35)")

Will return blank

Maybe you can rewrite to an alternate Like

(\r|\n){2,4}

Another Option could also be
(?<=text = “)(.|\n)*?(?=”)

Hi, try this:

output = System.Text.RegularExpressions.Regex.Match(input,"(?<=word\s+)[\w ]+(?=35)",System.Text.RegularExpressions.RegexOptions.Singleline).Value

Preview link: https://regex101.com/r/Zv0KJg/1

Spot on

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.