Help this Neophyte learn REGEX
Posted: Sat Jan 22, 2005 9:08 pm
I'm finally getting around to tackling REGEX.... Of all the things I've learned about PHP, REGEX was never on the top of my list. Anyway -- I got this little snippet of code to work fine -- basically, I wanted it to remove the whole string including the comment marks. Then I added the extra characters $%#^ etc. and can't get it to work. Does somebody know how I would change this REGEX to replace the entire $String?
Code: Select all
$string = "<!--THIS TEXT I WA#$%^@NT OUT OF HERE-->JHGFJTHFHT";
$clean_string = preg_replace("/<!--їa-z0-9]\s+-->/i", "", $string);
echo $clean_string;