Solved

Modification to the previous regular expression

Posted on 2009-07-14
5
257 Views
Last Modified: 2012-05-07
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
Comment
Question by:msd_informatique
  • 3
  • 2
5 Comments
 
LVL 3

Author Comment

by:msd_informatique
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

by:
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

by:Terry Woods
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

by:Terry Woods
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

by:msd_informatique
ID: 31603550
Thanks that worked like a charm :)

Regards
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now