Re: [PHP] Re: Space in regex

2006-11-17 Thread Dotan Cohen
On 17/11/06, Paul Novitski [EMAIL PROTECTED] wrote: At 11/16/2006 03:19 PM, Dotan Cohen wrote: However, this function: $text=preg_replace_callback('/\[([A-Za-z0-9\|\'.-:underscore:]+)\]/i' , findLinks, $text); Does what I want it to when there is no space, regardless of whether or not there is a

[PHP] Re: Space in regex

2006-11-16 Thread Dotan Cohen
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:

Re: [PHP] Re: Space in regex

2006-11-16 Thread Dave Goodchild
I ran this expression through Regex Coach: \[([A-Za-z0-9\'.-:underscore:\s]+)\|([A-Za-z0-9\'. -:underscore:]+)\] ...and it matched the patterns your describe.

Re: [PHP] Re: Space in regex

2006-11-16 Thread Jon Anderson
Dotan Cohen wrote: 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

Re: [PHP] Re: Space in regex

2006-11-16 Thread Paul Novitski
At 11/16/2006 01:56 PM, Dotan Cohen wrote: $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:

Re: [PHP] Re: Space in regex

2006-11-16 Thread Dotan Cohen
On 17/11/06, Paul Novitski [EMAIL PROTECTED] wrote: Dotan, I'm surmising what you really want to do is grab all the characters between [ and | for the first field, and everything from | to ] as the second field. I would therefore identify the first field with: [^\]|]

[PHP] Re: Space in regex

2006-11-16 Thread Myron Turner
The underscore plus alphanumeric are included in \w, so to get a regex such as you want: [\w\s\.\-\']+ You should escape the dot because the unescaped dot stands for any single character, which is why .* stands for any and all characters. Dotan Cohen wrote: I'm trying to

[PHP] Re: Space in regex

2006-11-16 Thread Myron Turner
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

Re: [PHP] Re: Space in regex

2006-11-16 Thread Paul Novitski
At 11/16/2006 08:46 PM, Myron Turner wrote: The underscore plus alphanumeric are included in \w, so to get a regex such as you want: [\w\s\.\-\']+ You should escape the dot because the unescaped dot stands for any single character, which is why .* stands for any and all

Re: [PHP] Re: Space in regex

2006-11-16 Thread Dotan Cohen
On 17/11/06, Paul Novitski [EMAIL PROTECTED] wrote: At 11/16/2006 08:46 PM, Myron Turner wrote: The underscore plus alphanumeric are included in \w, so to get a regex such as you want: [\w\s\.\-\']+ You should escape the dot because the unescaped dot stands for any single

Re: [PHP] Re: Space in regex

2006-11-16 Thread Paul Novitski
At 11/16/2006 03:19 PM, Dotan Cohen wrote: However, this function: $text=preg_replace_callback('/\[([A-Za-z0-9\|\'.-:underscore:]+)\]/i' , findLinks, $text); Does what I want it to when there is no space, regardless of whether or not there is a pipe. It does not replace anything if there is a