Do you have a question? Post it now! No Registration Necessary. Now with pictures!
August 31, 2011, 10:23 pm
rate this thread
Re: php help
You didn't specify what these unknown characters should be.
I am guessing non-whitespace. In that case this would be appropriate:
$newstring=preg_replace ('/â\S\S/i', '',$newstring);
So that would match:
But wouldn't match:
Note the "single" quotes (apostrophe) instead of your double quotes (that
don't need to escape backslash).
If you want to match anything then use:
$newstring=preg_replace ('/â../i', '',$newstring);
That would match any case of the above.
September 1, 2011, 8:44 am
Re: php help
"Not quite right". Nice description. As useful as "Does not work" :)
The "?" symbol means "any character" in Windows wildcards but not in
regular expressions. You want "." instead:
var_dump( preg_replace ('/â../i', '', 'âabKeep Me!') );
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
- » try / catch or INSERT INTO... ON DUPLICATE KEY UPDATE
- — Next thread in » PHP Scripting Forum
- » Strategic Marketing Summit 2011 (September 24th,Chennai)
- — Previous thread in » PHP Scripting Forum