I have this snippet of code from an old OsCommerce install
$pattern = $this->attributes['SEO_REMOVE_ALL_SPEC_CHARS'] == 'true'
? "([^[:alnum:]])+"
: "([[:punct:]])+";
I would like to modify the [:punct:] selector so it excludes the - dash.
next line of code is
$anchor = ereg_replace($pattern, '', strtolower($string));
which removes the previously found characters. how can I keep my dashes?
Thanks, Mario
EDIT
I think i got it:
$pattern = $this->attributes['SEO_REMOVE_ALL_SPEC_CHARS'] == 'true'
? "([^[:alnum:]])+"
: "([^-a-zA-Z0-9[:space:]])+";
note: the dash has to come first. or, for underscores:
$pattern = $this->attributes['SEO_REMOVE_ALL_SPEC_CHARS'] == 'true'
? "([^[:alnum:]])+"
: "([^a-zA-Z0-9_[:space:]])+";
I didn't figure out how to use negative lookaheads :(. Cheers. Mario