A friend of mine updated your regular expression... Check it out if your
interested.
Jeremy
Dear Jeremy,
Thanks for writing!
> I saw this regular expression and thought you might like it... :)
> >preg_replace("/^\/?(.*)\/[\w]+\.php$/","$1",$PHP_SELF)
> >
> >that strips that leading forward slash too ;-)
\w is a PCRE (Perl-Compatible Regular Expression) that matches any
word character: a-z, A-Z, 0-9 and the underscore "_". sed and awk do
not support \w, although ssed (super-sed) supports \w if an -R switch
is added on the command line.
Back to PHP and \w : Putting \w by itself inside a character class
"[...]" does absolutely nothing, just as "[a]" and "[9]" does nothing
special. It could be more efficiently written as:
/^\/?(.*)\/\w+\.php$/
One additional problem is that the characters defined by \w does
not include the hyphen, the pound sign, or other punctuation marks
that sometimes find their way into filenames, like:
four-to-go.php
page#10.php
convert$toDM.php
so in this case, a character set should be used:
/^\/?(.*)\/[\w~!@#$%^&*+=-]+\.php$/
Keep 'em coming!
--
Eric Pement - eric.pement@xxxxxxxxx
Educational Technical Services, MBI
Jeremy Peterson, MACS
Automation Systems Administrator
Crowell Library
Moody Bible Institute
820 N. LaSalle Drive
Chicago, IL, 60610
Email: jpeterso@xxxxxxxxx
Phone: 312.329.8081
Fax: 312.329.8959