Full Text =
"
......
A=
B= 12345
....."
I want to get empty word "" between A= and line break. and want to get "12345" between B= and line break.
How can I get words using regular expression?
(?<=A=)\s*(\S*)\s*
or
(?<=B=)\s*(\S*)\s*
But, it also brought the next line contents.
How about this pattern:
(?<=[A-Z]=)[ ]*(\S*)
This pattern avoids the problem of wrapping over to the next line by first only allowing spaces after the A=
(or B=
etc.). This means that in the case of the A=
line, which only has a newline character after it, the [ ]*
would match zero times. Second, for the content it only uses (\S*)
, which also will not consume whitespace and wrap to the next line.