Mod_rewrite problems

Associate
Joined
30 Dec 2005
Posts
415
Greetings all!

I'm just writing a mod_rewrite rule, but wanted to get a few pointers...

For $1 of the URL, it needs to match underscores, all letters (regardless of case) and all numbers.
For $2 of the URL, it needs to match $ - _ . + ! * ' ( ) , all letters (regardless of case) and all numbers.

This is what I have so far:
Code:
RewriteRule ^zones/([_a-zA-Z0-9-]+)/things/(['_a-zA-Z0-9-]+)/discussion/$ things/discussion_newtopic.php?z=$1&t=$2 [NC]

Have I done this right? How would I add the special characters - Just escape them with a backslash?

Cheers all!
 
Cheers guys!

I had a go at writing it, and in my RegExp tester (software based), and this works fine:
Code:
^[a-zA-Z0-9 '\(\)-]*$|
Running it by the string
Code:
hello world '()- gf hgfh fgh

However, when I put this in the PHP, PHP kicks up an error:
Warning: preg_match() [function.preg-match]: No ending delimiter '^' found
So I added a | to the front of the regexp, and it runs fine, but doesn't match the string :(
 
Back
Top Bottom