i have text like this
aaa111
bbb222
ccc333
ddd444
and i need to match with Regular Expression from specified character to second new line
for example from bbb return like this :
bbb222
ccc333
i used this code but not work fine
Match match = Regex.Match(nums, @"\bbbb\w*\b");
CodePudding user response:
Submitting my comment to answer so that solution is easy to find for future visitors.
You may use this regex:
\bbbb(?:.*\r?\n){2}
RegEx Breakup:
\b
: Word boundarybbb
: Matchbbb
(?:.*\r?\n){2}
: Match any text followed by a line break. Repeat this group 2 times
CodePudding user response:
If your data is well constrained, you can use
^bbb\d{3}\s\w{3}\d{3}$