regular expression

Igor says (in the manual section on Regular Expressions):
Quote:
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.
awirsing wrote:

I am wondering if this default behaviour can be changed.
That means how to make the dot match also a newline.


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
jjweimer wrote:
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?


Well, I have yet found a workaround, but the term "by default" implies that there is also a non-default...
If you were using Perl, for example, you would supply the \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:

The other PCRE-specific options (m, s, x, and X) are not useful with Igor's regular expression commands.

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("\r\n", theString, "\r")
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.
Igor's PCRE implementation does support (?s) and the other match options. I've revised the documentation to make that a little more clear.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.