easy regex question... I'm just not smart enough
Moderator: General Moderators
easy regex question... I'm just not smart enough
Hey there
I'm trying to embed a regex variable in this URL and I can't seem to figure out which is the right one.
The link example is:
http://strategy.thesuccessleague.com/MV ... PURLPage=7
I need to find a regex variable that will replace "MVanDusen" (It's always someone's name, so the length will very from person to person)
I tried this: http://strategy.thesuccessleague.com/[:alnum:]?elqPURLPage=7
but it didn't seem to work
Any help would be beautiful
Thanks!
I'm trying to embed a regex variable in this URL and I can't seem to figure out which is the right one.
The link example is:
http://strategy.thesuccessleague.com/MV ... PURLPage=7
I need to find a regex variable that will replace "MVanDusen" (It's always someone's name, so the length will very from person to person)
I tried this: http://strategy.thesuccessleague.com/[:alnum:]?elqPURLPage=7
but it didn't seem to work
Any help would be beautiful
Thanks!
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
I am utterly clueless as to what an [:alnum:] tag is.
Code: Select all
#/([\w]+)\?#- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
[:alnum:] is a POSIX character class and not compatible with PCRE. I guess it is equivalent to [a-zA-Z0-9].
Try this regex:
Try this regex:
Code: Select all
#http://strategy\.thesuccessleague\.com/(.*?)\?elqPURLPage=7#Are they? Seems like you're right indeed, feyd. This surprises me. Did some test and as long as you put the POSIX character class inside a regular character class, it works (otherwise you'll get this error apparently: Compilation failed: POSIX named classes are supported only within a class).feyd wrote:[:alnum:] is supported by PHP's PCRE last I checked.
Nice to know you can use them, however I'm not a big fan and will probably avoid them anyway.