I hate Regex |
[eluser]Iverson[/eluser]
Crazy question... I'm addicted to the substr function, but there doesn't seem to be a way to do this using a regex. I know about preg match and preg replace, bla bla bla, but this doesn't serve my purpose. I need to extract a string when I don't know what the actual string will be. I only know what the surrounding text will be.
[eluser]TheFuzzy0ne[/eluser]
preg_match() does exactly this. http://uk.php.net/manual/en/function.preg-match.php There are other functions that server a similar function, such as eregi(), and ereg(). Use brackets to capture the text you want. If you're serious about learning Regular Expressions, you can check out the great tutorials [url="http://www.regular-expressions.info/"]here[/url]. Just bear in mind that there are different types of Regular Expressions that use different syntaxes, for example, preg_match() uses Perl regular Expressions. Code: <?php
[eluser]Iverson[/eluser]
[quote author="Eric Cope" date="1231469450"]Would an XML parser do the trick?[/quote] I like the way you think! I just finished putting it in somewhat of an XML format: Code: <title>Column Title</title> Too bad CI doesn't have a neat XML parser. I'll look into using SimpleXML. |
Welcome Guest, Not a member yet? Register Sign In |