chukz
(delon)
October 6, 2020, 8:55pm
1
I have a project where I’m trying to read all files in a folder and remove specific text between the given symbol.
I have a text file that contains text within #! and I would like to remove all text within #!
What I have so far,
The expression I have is : System.Text.RegularExpressions.Regex.Replace(txtinput,“(?<=#!).*(?=#!)”," ")
The current output I get,
thanks for anyone who can help
ppr
(Peter Preuss)
October 6, 2020, 9:50pm
2
@chukz
I would suggest to look for finding the reason for this behaviour here by the statement explanation (taken from regex101)
Maybe this helps for rewriting the statement
Give a try by using an ungreedy approach as below:
(#!)((.*?\r?\n?)*)(#!)
chukz
(delon)
October 7, 2020, 12:57pm
3
Thank you it worked. Thanks for sharing the regex101 as well.
system
(system)
Closed
October 10, 2020, 12:57pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.