Sign in to follow this  
Followers 0
Starfighter

StringRegExpReplace and delete selective strings

3 posts in this topic

Hi People,

I've a problem with the StringRegExpReplace function:

I want delete all URL-Links, only between <td class=char>xxx</td> and <td class=nm> tags (xxx=any string).

Dim $InputString

Dim $OutputString

$InputString="<h5>Photo Gallery:</h5><http://i.imdb.com/Photos/Ss/0090605/th-IMG0064.jpg><http://i.imdb.com/Photos/Ss/0090605/th-6053_16_1.jpg><h5>Cast:</h5><td class=nm>Sigourney Weaver</td><td class=char>Ellen Ripley</td><td class=nm>Carrie Henn</td><td class=char>Rebecca 'Newt' Jorden</td><http://ia.imdb.com/media/imdb/01/I/51/65/22t.jpg><td class=nm>Michael Biehn</td><td class=char>Cpl. Dwayne Hicks</td><http://ia.imdb.com/media/imdb/01/I/73/36/29t.jpg><td class=nm>Lance Henriksen</td><td class=char>Bishop</td>"

$OutputString=StringRegExpReplace($InputString,"<td class=char>[\^]</td>(.*?)<td class=nm>","<td class=char>[\^]</td><td class=nm>")

Msgbox(0,"Test",$OutputString)

What's wrong?

Best thanks for your help

Share this post


Link to post
Share on other sites



When you replace the text, the replacement string needs to be exact. There's probably a better way to do it, but I think this should give you what you want:

$OutputString = StringRegExpReplace($InputString,"</td><http(.*?)<td class=nm>","</td><td class=nm>")

Share this post


Link to post
Share on other sites

When you replace the text, the replacement string needs to be exact. There's probably a better way to do it, but I think this should give you what you want:

$OutputString = StringRegExpReplace($InputString,"</td><http(.*?)<td class=nm>","</td><td class=nm>")
Thank you very much!

I'm blind :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0