Jump to content


Photo

some1 who knows regex + eval pls help!!!


  • Please log in to reply
1 reply to this topic

#1 jgp4

jgp4
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 25 October 2006 - 06:42 PM

I've been going thru forum after forum looking for an answer to this, but can find nothing, so I hope someone here can help.

Say I have a string, and inside it is the text ::include(/includes/snippets/snippet.php)::

what i'd like to do is find that text, extract the text from between the ::'s and eval() it, then do a preg_replace to insert the code generated back in - can someone help, I have no idea how to do regex's.

Thanks.

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 25 October 2006 - 07:01 PM

Use preg_replace_callback; your regex will be /::(.+?)::/.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users