sangoku Posted May 5, 2010 Share Posted May 5, 2010 Ok i have astring that i need to convert into a stroing that can be executed via eval. I am pretty free with the input format... It can be somthing like this ( a + b ) / c > a or any other value.. or equation. Basically i need a reg ex which skips symbols and puts before the character combination "$this->" can someone help me out? Quote Link to comment https://forums.phpfreaks.com/topic/200846-convert-abc-to-this-athis-bthis-c/ Share on other sites More sharing options...
salathe Posted May 6, 2010 Share Posted May 6, 2010 It seems a little strange that you just want to blindly insert the string but to get what you want, you can just do: preg_replace('/[a-z]+/', '$this->$0', $subject) Quote Link to comment https://forums.phpfreaks.com/topic/200846-convert-abc-to-this-athis-bthis-c/#findComment-1054033 Share on other sites More sharing options...
sangoku Posted May 6, 2010 Author Share Posted May 6, 2010 XD thy very much!!!!! tooth i would be stuck on it... dam regex...... never have time to learn it... Quote Link to comment https://forums.phpfreaks.com/topic/200846-convert-abc-to-this-athis-bthis-c/#findComment-1054337 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.