x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 269

# Modification to the previous regular expression

Hi Guys,

sorry to bother you again...

The previous regular expression worked like a charm but now, I want to exclude this specific string from it:
"{\pict\wmetafile8\picw6615\pich1852\picwgoal3750\picscalex150\pichgoal1050\picscaley150\sspicalign0 " followed by anithing and closed by "}"

So, I want to replace all the "{\pict" followed by anything and closed by "}" except if it is the block I don't want to replace

Can any of you help me on this one

Btw, any good regular expression book you could suggest ?

Regards

0
msd_informatique
• 3
• 2
1 Solution

Author Commented:
Btw, in case it's not clear, there is a link to the previous question...
http://www.experts-exchange.com/Programming/Languages/Regular_Expressions/Q_24561714.html
0

IT GuruCommented:
Try this:

toExclude = preg_quote('\wmetafile8\picw6615\pich1852\picwgoal3750\picscalex150\pichgoal1050\picscaley150\sspicalign0','/'); echo preg_replace("/\{\\\\pict(?!toExclude).*?\\}/s", '', \$s);
0

IT GuruCommented:
Sorry, I can't recommend a book - you might be best asking that as a separate question to get a better response.
0

IT GuruCommented:
But if you're not aware of the PCRE Cheat Sheet, it's well worth bookmarking - it's linked from here:
http://www.phpguru.org/article/pcre-cheat-sheet
0

Author Commented:
Thanks that worked like a charm :)

Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Featured Post

• 3
• 2
Tackle projects and never again get stuck behind a technical roadblock.