Solved

# Modification to the previous regular expression

Posted on 2009-07-14
258 Views
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
Question by:msd_informatique
• 3
• 2

LVL 3

Author Comment

ID: 24855424
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

LVL 35

Accepted Solution

Terry Woods earned 100 total points
ID: 24855478
Try this:

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

LVL 35

Expert Comment

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

LVL 35

Expert Comment

ID: 24855498
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

LVL 3

Author Closing Comment

ID: 31603550
Thanks that worked like a charm :)

Regards
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …