Jul 1, 2011, 2:33 PM
Post #1 of 2
I'm not sure if you can call it a challenge but the nature of regex is challenging, at least to me .
interesting regex challenge
Anyway I have a string like this:
$string = '^i&jf'e%o@#]ed=fng&dwp3tll1"h2\3r5@~@:'
what I want to do is (it's crazy) strip all the special characters and numbers out of the string, I can do that using \(?[^a-z]|(?<=['\"]) apart from the quotation mark, not sure how to do this, then im left with a quotation mark and some random letters, from this using regex i want to code print "hello"; then i'll use eval to execute it.
I know its insane and sounds pointless but i'm just very interested in doing this, i've tried for ages but kept failing is this even possible by just using mostly regex?
ps: been using http://gskinner.com/RegExr/ to test the regex patterns, its quicker.
(This post was edited by soeeom on Jul 1, 2011, 2:35 PM)