Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Modification to the previous regular expression

Posted on 2009-07-14
5
Medium Priority
?
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

715 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