Thank you!! It worked!! The wrong sample was 'dot'11'dot'abcd, but the first dot was not shown properly...
And, now I have another problem: In fact, the input strings are lines from a webpage, and they sometimes have line-feed as in: 11.abcd.32.efgh.54.ij <--here kh.41.lmno. <--here 63.pqrs And, with ereg_replace("(\.)([0-9])","\\1<br><br>\\2",$string), the result I expect is: 11.abcd. 32.efgh. 54.ijkh. 41.lmno. 63.pqrs. But, the actual result is: 11.abcd. 32.efgh. 54.ij <-- problem kh. 41.lmno. 63.pqrs. <-- problem I tried some more regular expressions to solve this, but they don work yet. So, please help me~~ Thank you in advance. Joshua ----- Original Message ----- From: "Kelly Hallman" <[EMAIL PROTECTED]> To: "Joshua" <[EMAIL PROTECTED]> Cc: "PHP General list" <[EMAIL PROTECTED]> Sent: Saturday, December 27, 2003 1:27 PM Subject: Re: [PHP] Regular Expression > On Sat, 27 Dec 2003, Joshua wrote: > > I'm trying to change the string, for example, > > > > $string = "11.abcd.32.efgh.53.ijk"; > > to > > > > 11.abcd. > > 32.efgh. > > 53.ijk. > > > > with ereg_replace. Like > > ereg_replace("\.[0-9]","<BR>",$string); > > How can I recover the original characters after replacing them with <BR> > > in ereg_replace? > > > > ereg_replace("\.[0-9]","<BR>\\0",$string) gives me the > > wrong result like: > > > > 11.abcd. > > 32.efgh. > > 53.ijk. > > Since the output you want and the output you didn't want are identical in > your post, it was hard to tell what you were trying to do, but... > > I think this is what you want.. > ereg_replace("(\.)([0-9])","\\1<br>\\2",$string); > (minus the last decimal point, missing from your original string) > > -- > Kelly Hallman > // Ultrafancy > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php