Bosconian wrote:
Using preg_replace() is there a simple regexp to strip everything from a
string except alpha and numeric chars (a-zA-Z0-9)?
$input = "$tring1!";
$pattern =
$input = preg_replace($pattern, "", $input);
result: "tring1"
Chances are anything you will ever try to do with regexp's has been done,
and there may even be a shortcut for it. So at this page:
http://www.php.net/manual/en/referen...ern.syntax.php
you would be able to find this:
$input = preg_replace('\W','',$input)
This will leave in underscores, but that is easily fixed:
$input = preg_replace('[\W_]','',$input)
Also try reading an introduction to regexp's in a Perl guide, you can likely
find something more of a tutorial there to get you started.
--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)