Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-27-2014, 03:57 PM #1
- Join Date
- Feb 2010
- Thanked 0 Times in 0 Posts
eregi_replace to preg_replace help
Can anyone help me please, I have the below eregi_replace, but am getting an error.
How do I change it to work with preg_replace
$title = eregi_replace('</?[a-z][a-z0-9]*[^<>]*>', '', $title );Regards,
02-27-2014, 04:12 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Since you make no use of eregi specific patterns, this is literally as simple as using:
'~</?[a-z][a-z0-9]*[^<>]*>~i'for your pattern. Simply change to preg_replace. If the pattern doesn't make use of ereg specific patterns, the only thing you need to change is adding a delimiter to the string, and if its insensitive add the i to the end.
For this particular replace, strip_tags may be an ideal replacement though as it should operate much faster than the pattern matching (matching is a very expensive operation).
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');