View Single Post
Old 01-27-2012, 11:23 PM   #14
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 455
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by Serpentine View Post
(?s) is 'single line', it evaluates everything as a single line - as such .'s are not restricted to a single line, they will wrap. However if you are explicitly looking for \s's, those will also wrap around if you were not using single line, as they match the line break [\n\r].

In multiline (?m), you can use multiple [^$] to match the stard/end of lines, rather than the whole string.

As always, check out http://www.pcre.org/pcre.txt
It's surprisingly easy to read, just search around for a good starting point.

EDIT: WAAAAIT a minute. So are you saying that .* doesn't include \s, \n, or \r, but [^\.](for example) does? In other words, searches that use . match everything except \n \s and \r, whereas searches that use ^ match every value (including \n, \r, and \s) except the value that follows it? I think (i hope) this is becoming slightly clearer. So then is there an expression that would search for the kind of string i'm looking for now but restrict the search to a single line of code? ie maybe something that uses ^ to negate \n values?

Last edited by ElMiko; 01-28-2012 at 12:38 AM.
ElMiko is offline   Reply With Quote