[SATLUG] Regexp help

Channing Channing.ML at ChanningC.com
Mon Sep 15 22:23:03 CDT 2008



twistedpickles wrote:
> Working on mod rewrite regexp and I'm at a road block.
>
> My url's look like this: www.website.com/2/index.php?artist=billy%20bob
>
> With rewrite they now look like this: www.website.com/2/artist/billy_bob
>
> But last minute I decided I want them to look like this:
> www.website.com/2/artist/billy-bob
>
> I can't change my mod rewrite rule to exclude the "_" because the URLs have
> already been embedded in my enhanced podcast.
>
> My actual regexp:
>
> Options +FollowSymLinks
> RewriteEngine on
> RewriteRule ^2/artist/([A-Za-z0-9._]*[A-Za-z0-9-._]*)$
> /2/index.php?artist=$1 [NC]
>
> I'm not sure where to stick the "-" to make it work. I've tried before the
> "." and after the "_" without success.
>
> Thanks for your help.
>
> ::twistedPickles:: :
>   
Dashes are special as they also denote a range of characters/numbers.  
Try adding the dash as the first character within your character 
grouping (first character after the opening brace).

Channing



More information about the SATLUG mailing list