birbal Posted October 23, 2010 Share Posted October 23, 2010 i am using str_replace for smiley genartor from a stirng. till now it is running well. but the problem is ...it is replacing all the matched string. i want to customize that. i mean only first 2 match or 3 match will be replaced. so is there any way to do this without using preg_replace?and i forgot to ask. what is replacment order gotcha? i am not getting it. can any give a practical example to ilaborate it?thank you! Link to comment Share on other sites More sharing options...
Synook Posted October 23, 2010 Share Posted October 23, 2010 There is a PHP BBCode module: http://www.php.net/manual/en/book.bbcode.php. Link to comment Share on other sites More sharing options...
birbal Posted October 23, 2010 Author Share Posted October 23, 2010 There is a PHP BBCode module: http://www.php.net/manual/en/book.bbcode.php.i think thats need extra installation of libary. which i dont have. and most probably my host dont suport it. once i used this function. it was showing undefined function.so i was avoiding this. so i have to do that with preg_replace or str_replace. it will be good if there is a way to do that in str_replace. it is ok with preg_replace but i was finding a way to do it with str_replace as i said above. so need some guide. Link to comment Share on other sites More sharing options...
Fmdpa Posted October 23, 2010 Share Posted October 23, 2010 If you are trying to avoid learning RegEx, I would not recommend that. It is a very useful and powerful tool that you will use many times in the building of any site that accepts user input. The PHP manual has a section devoted to PCRE (Perl-compatible Regular Expressions). Link to comment Share on other sites More sharing options...
birbal Posted October 23, 2010 Author Share Posted October 23, 2010 If you are trying to avoid learning RegEx, I would not recommend that. It is a very useful and powerful tool that you will use many times in the building of any site that accepts user input. The PHP manual has a section devoted to PCRE (Perl-compatible Regular Expressions).no...not so...i am spending time behind regex evryday to be perfect with it. even i am using regex in other tag ...i can do that with regexp for smiley..but in the manual of php.net they are saying that avoid preg_replace() where you can use str_replace(). so i am finding a way to do that with str_replace() where i can limit the number of replace anyhow. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.