Page is a not externally linkable
- Code, Content, and Presentation
-- HTML
---- regular expression find across line breaks


swa66 - 10:57 pm on Sep 27, 2012 (gmt 0)


I've no clue what type of regexps "winautomation" uses (whatever it is).

In perl regular expression:

*? is typically an ungreedy match instead of the default greedy match.

e.g.:
data: = "mississippi";
regexp = "/(i.*s)/"
would give "ississ"

data = "mississippi";
regexp = "/(i.*?s)/"
would give "is"

There's a modifier to treat the data as a whole as one line it's "m":

data= "a\nb\nc\n"
regexp = "/a\nb/m"
would match

The easier way to deal with complex data is to parse the html as xml ... but that requires good xhtml which is far too rare. That's how I do things - it's also much more efficient than very complex regexps will be.


Thread source:: http://www.webmasterworld.com/html/4500354.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com