Hi fletchsod,
Here is a very good tutorial:
http://www.regular-express
---
Harish
Main Topics
Browse All TopicsHow do I get this preg_replace() to work? Is there a tutorial or reference of how do we know we need to use those strange characters? php.net doesn't provide this type of tutorial for strange characters as far as I can find.
--snip--
$patterns[0] = "|\[b\](.*?)\[/b\]|s";
$patterns[1] = "|\[i\](.*?)\[/i\]|s";
$patterns[2] = "|\[u\](.*?)\[/u\]|s";
$replacements[0] = "<b>\$1</b>";
$replacements[1] = "<i>\$1</i>";
$replacements[2] = "<u>\$1</u>";
ksort($patterns);
ksort($replacements);
$RawData = "kkkkert [B]sdf[/B] shuuuooo";
$ConvertedData = preg_replace("|\[b\](.*?)\
echo $ConvertedData;
--snip--
Thanks...
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi fletchsod,
Here is a very good tutorial:
http://www.regular-express
---
Harish
Well, I prefer the simplier syntax... :-) I just got it!! Didn't know this whole things is called "Regular Expression", so found the documentation at http://us2.php.net/manual/
Turned out my problem had to do with the case sensitivity. I used a lowercase "b" instead of an uppercase "B". Sigh!!! I learned about that from http://us2.php.net/manual/
Code:
|\[b\](.*?)\[/b\]|sU
and to make it less greedy, I would take out the "?" and add the "i' to it. This accomplish the same thing, I think...
Code:
|\[b\](.*)\[/b\]|siU
But I'll leave out the "U" part to make this case sensitivity part stick for now... Sorry to bother, now that I have the reference and examples from http://weblogtoolscollecti
Thanks...
fletchsod, if you want to split points, you can click "Split" link at the top of the text area where you write the comment.
If you want to split the points, post a 0 point question to reopen the question in the community support area and ask the moderators to reopen the question..
http://www.experts-exchang
Business Accounts
Answer for Membership
by: mensuckPosted on 2005-10-12 at 10:49:43ID: 15071114
Something like this....
, '#\\[i\\](.*)\\[/i\\]#siU' , '#\\[u\\](.*)\\[/u\\]#siU' );
<?
$old = array ( '#\\[b\\](.*)\\[/b\\]#siU'
$new = array ( '<b>\\1</b>', '<i>\\1</>', '<u>\\1</u>' );
$RawData = "kkkkert [B]sdf[/B] shuuuooo kkkkert [u]sdf[/U] shuuuooo kkkkert [i]sdf[/I] shuuuooo
kkkkert [B]sdf[/B] shuuuooo kkkkert [u]sdf[/U] shuuuooo kkkkert [i]sdf[/I] shuuuooo";
$ConvertedData = preg_replace ( $old, $new, $RawData );
echo $ConvertedData;
?>
ms!