corrupshun Posted January 4, 2010 Share Posted January 4, 2010 I do not understand it. Whenever something is going to be replaced it looks like complete crap... Can someone explain what this means and explain how you deciphered it? <?php preg_replace("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtoupper('\\2').'\\3'", $html_body); ?> That is some random code I found on a tutorial for this.. I cannot read it.. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/187179-preg_replace/ Share on other sites More sharing options...
monkeypaw201 Posted January 4, 2010 Share Posted January 4, 2010 Thats actually a regular expression, take a look here: http://www.webcheatsheet.com/php/regular_expressions.php Its a simple break-down of what's going on. Quote Link to comment https://forums.phpfreaks.com/topic/187179-preg_replace/#findComment-988431 Share on other sites More sharing options...
Mchl Posted January 4, 2010 Share Posted January 4, 2010 Also see here for some good explanataions: http://www.regular-expressions.info/ Quote Link to comment https://forums.phpfreaks.com/topic/187179-preg_replace/#findComment-988437 Share on other sites More sharing options...
MadTechie Posted January 4, 2010 Share Posted January 4, 2010 The RegEx converts the html tags to upper case. for example <?php $html_body = "<body><P>Hello World</P></body>"; $html_body = preg_replace("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtoupper('\\2').'\\3'", $html_body); echo $html_body; ?> returns <BODY><P>Hello World</P></BODY> note that body becomes BODY Quote Link to comment https://forums.phpfreaks.com/topic/187179-preg_replace/#findComment-988460 Share on other sites More sharing options...
corrupshun Posted January 4, 2010 Author Share Posted January 4, 2010 thank you to all for the fantastic links and info Quote Link to comment https://forums.phpfreaks.com/topic/187179-preg_replace/#findComment-988462 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.