Please kindly provide a line-by-line trimming needle for a regex.Matches scheme (not regex.Replace) such that the matched results preserve the original line count (which is 22 lines), i.e. regex.Matches(text,needle,RegexOptions.Multiline).count = 22
Thank you.
Regular Expressions
Last Comment
Bill Prew
8/22/2022 - Mon
Zvonko
Like this: /(^\s*|\s*$)/gmi
Thomas PAIK
ASKER
The regex.Match result should be something like that of below (please kindly refer to the SUBSTITUTION section of the link), but NOT through using regex.Replace: https://regex101.com/r/lSRoEn/1
/(^\s*|\s*$)/gmi