This is a discussion on Spaces and newlines in regular expressions within the PHP Language forums, part of the PHP Programming Forums category; How can I signify a space or a newline in a regular expression? Are they just represented by whitespace and \...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Kyle wrote:
> How can I signify a space or a newline in a regular expression? Are > they just represented by whitespace and \n? > > Thanks! There's a character class "\s" that matches any whitespace character. You can also use the regex form "/regex/s" to turn on PCRE_DOTALL, so that the dot will match the "\n" newline characters as well. Note that newlines are platform dependant and can be "\n" or "\r\n," etc... -- Elliott C. Bäck http://elliottback.com/ |