If you are a PHP programmer and if you are using regular expressions with ereg_replace then often with replacing particular characters you might encounter error like
Warning: ereg_replace(): REG_BADRPT
Here is a simple function that causes this error
function OrigURL($str)
{
$out = ereg_replace('+',' ',$str);
return $out;
}
Solution: Just escape the characters. Only then it will work.
$out = ereg_replace(‘\+’,’ ‘,$str);
Hope this would help!
Similar Posts:
- PHP – How to get domain name from URL?
- how to strip special characters with jQuery form validation!
- Single/double quotes causes error in mysql INSERT query!
- Quick & Easy Form Validation Tutorial with JQuery
- how to get selected textarea value using javascript
- FIX->Fatal error: Maximum execution time of 300 seconds exceeded with phpMyAdmin
- How to remove GET variable within $_SERVER['QUERY_STRING'] in PHP
- How URL shortening scripts work?
- easyapache -Premature end of script headers error in cpanel
- how to check if image loaded or not in javascript?


January 23, 2009
but the regex wont be the same. what if the + means that the expression be matched one or more times escaping it would match the plus (+) character