?
Solved

Multiple delete tag in html regex

Posted on 2013-01-09
7
Medium Priority
?
953 Views
Last Modified: 2013-01-09
Hello,

I have  a program that inserts tags into html like this:

<img src="msggen/LwedmAsTMPwwCy4ECXv44AMSG5MSG5.png-msgpwidth=320&msgpheight=-1&msgwebwidth=320.png" tppabs="http://url.com/msggen/LwedmAsTMPwwCy4ECXv44AMSG5MSG5.png?msgpwidth=320&msgpheight=-1&msgwebwidth=320" />

I need to delete all the tppabs="http://url.com/msggen/LwedmAsTMPwwCy4ECXv44AMSG5MSG5.png?msgpwidth=320&msgpheight=-1&msgwebwidth=320"

what is the regex I can use for a find and replace program.

Thank you

Fernando
0
Comment
Question by:localseo
[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
  • 4
  • 3
7 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 2000 total points
ID: 38760781
$htm = "<img src="msggen/LwedmAsTMPwwCy4ECXv44AMSG5MSG5.png-msgpwidth=320&msgpheight=-1&msgwebwidth=320.png" tppabs="http://url.com/msggen/LwedmAsTMPwwCy4ECXv44AMSG5MSG5.png?msgpwidth=320&msgpheight=-1&msgwebwidth=320" />";
$result = preg_replace('%tppabs.*(?=/>)%im', '', $htm);

Cheers
0
 

Author Comment

by:localseo
ID: 38760801
But what do I use for find field and then replace field, in program like bbedit?

Thanks
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 38760826
I don't know bbedit. Using notepad++ you only need to open Replace panel (menu Search->Replace) check Regular Expression radio button, type in the reg ex, the replacement value and click Replace All.
 Maybe bbedit has something similar...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 31

Expert Comment

by:Marco Gasi
ID: 38760843
Perhaps this is useful: http://www.journey-of-flight.com/bh_bbedit/how-to/useful_regex/index.php (see paragraph identified by 'image 7')
0
 

Author Comment

by:localseo
ID: 38760918
thanks, i downloaded notepad++

this should be the regex to use in find?

%tppabs.*(?=/>)%im  still get 0 results though

Thanks
Screen-Shot-2013-01-09-at-21.48..png
0
 

Author Closing Comment

by:localseo
ID: 38761078
Managed to get it to work,

thanks
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 38761819
I'm sorry if I didn't reply to you but I have gone to sleep. Thanks for point. What were wrong the first time? Seeing the screenshot I don't see anything wrong...
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

752 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