By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,932 Members | 1,486 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,932 IT Pros & Developers. It's quick & easy.

ereg_replace -->REG_BADRPT warning

P: 1
Hello I'm a bit new to regular expressions and I'm having a problem

I'm trying to strip any code which is inside a <p> tag for instance from
<p style="margin: 0in 0in 0pt;" class="MsoNormal">
to
<p>

I'm using the following line where $tmpString is the string of html pasted from word.

$tmpString = ereg_replace("<p.*?>", "<p>", $tmpString);

when I use this code I get the error
<b>Warning</b>: ereg_replace(): REG_BADRPT

I've used http://regexlib.com/RETester.aspx tool to see if the <p.*?> is working properly and it seems to be.

I tried replacing it with
preg_replace("<p.*?>", "<p>", $tmpString);
but this didn't work either it seems just replace every "p" with <p>

Any help much appreaciated.
Oct 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: 2
Hi I have found the solution , the issue due to special character esp for this warning REG_BADRPT error , use backslashing before any special chars in your pattern string.

For example:


$source = eregi_replace("\*", "", $invar)
May 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.