On 16/11/06, Dotan Cohen <[EMAIL PROTECTED]> 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/


I should add more information. This is the entire regex:
$text=preg_replace_callback('/\[([A-Za-z0-9\'.-:underscore:]+)\|([A-Za-z0-9\'.
-:underscore:]+)\]/i' , "findLinks", $text);

This regex should match any pair of square brackets, with two bits of
text between them seperated by a pipe, like these:
[Ety|wife]
[Jarred|brother]
[Ahmed|neighbor]
[Gili and Gush|pets]
[Bill Clinton|horny]

I would expect that the "." would match spaces, but it doesn't. So the
first three examples that I've shown are matched, but the last two are
not. I've even added "\w", "\s", " ", and ":space:" to the regex, but
of course that's not matching, either. What am I doing wrong? Note
that I've been honing my regex skills for the past few days, but I've
not so much experience with them. Thanks in advance to whoever can
help me understand this.

Dotan Cohen
http://lyricslist.com

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

Reply via email to