regular expression
awirsing
Dot, Period, or Full Stop
Outside a character class, a dot in the pattern matches any one character in the subject, including a nonprinting character, but not (by default) newline. Dot has no special meaning in a character class.
I am wondering if this default behaviour can be changed.
That means how to make the dot match also a newline.
A.
Given the power of RegEx in GREP, I would wonder that a suitable RegEx could not be found to do what you want without having to change a default behavior?
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
August 25, 2010 at 08:31 am - Permalink
Well, I have yet found a workaround, but the term "by default" implies that there is also a non-default...
August 25, 2010 at 08:38 am - Permalink
\s
or(?s)
option, which means that dot matches newline. However, towards the bottom of Programming.ihf, in the "Match Option Settings" section, there is this sentence:So I think the answer to your question is that no, this default behavior cannot be changed.
One workaround is to replace all linefeed characters with the carriage return character, since the dot matches
\r
. I usually do:theString = ReplaceString("\n", theString, "\r")
I will bring this thread to the attention of the author of Igor's various regular expression operations and functions, since this is an issue that I have had to deal with several times as well.
August 25, 2010 at 08:38 am - Permalink
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 2, 2010 at 12:31 pm - Permalink