Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mb_ereg_replace - unexpected greediness

Status
Not open for further replies.

OsakaWebbie

Programmer
Feb 11, 2003
628
0
0
JP
I have UTF-8 strings with square-bracketed bits interspersed, and some of the text (outside the brackets) is Japanese. Here is an example:
Code:
世[C]界中[G]を治[C]めてい[D]る主イエ[G]ス
If I apply the following:
Code:
mb_ereg_replace("\[[^\[]*\]","",$stanza)
...I end up with "世めていス" instead of the expected "世界中を治めている主イエス".

Experimentation has shown me that, at least for the strings I've looked at so far, using ereg_replace() instead of mb_ereg_replace() gives the correct answer. But why? I would have thought the exact opposite.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top