Re: Space in regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The \w regex includes all alphanumeric characters plus the underscore,
i.e. all valid characters that make up a C  identifier.  So what you
want can be expressed as follows:
	[\w\s\.\-&]+
You have to escape the dot because in a regular espression it
represents any single character, which is why .* represents all
characters.


Myron Turner
http://www.mturner.org/XML_PullParser/


On Thu, 16 Nov 2006 23:08:34 +0200, dotancohen@xxxxxxxxx ("Dotan
Cohen") wrote:

>I'm trying to match alphanumeric characters, some common symbols, and
>spaces. Why does this NOT match strings containing spaces?:
>[A-Za-z0-9\'.&-:underscore::space:]
>
>I've also tried these, that also fail to match strings containing spaces:
>[A-Za-z0-9\'.&- :underscore:]
>[A-Z a-z0-9\'.&-:underscore:]
>[:space:A-Za-z0-9\'.&-:underscore:]
>
>All these regexes match strings containing the specified characters,
>but none of them match strings with spaces.
>
>Dotan Cohen
>
>http://what-is-what.com/
>http://technology-sleuth.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux