Sign in to follow this  
Followers 0
michaelslamet

String Manipulation (RegEX ??) question

4 posts in this topic




#2 ·  Posted (edited)

Hi ms, long time no talk...

Try this...

local $str = '[Never delete this]And this [url="http://OnlyDeleteThis.com"]and dont delete this too'
ConsoleWrite(stringregexpreplace($str,'(.*)\[url=.*\](.*)','$1 $2') & @LF)

kylomas

edit: additional info

If the pattern to delete occurs multiple times in the string then try this... 

local $str = '[Never delete this]And this [url="http://OnlyDeleteThis.com"]and dont delete this too'
 $str &= '[some more text to not delete]And this [url="http://2ND one to delete.com"]keep the end also'
ConsoleWrite(stringregexpreplace($str,'\[url=[^\]]+\]',' ') & @LF)
Edited by kylomas
1 person likes this

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Hi Kylomas,

Yes, quite a long time :)

Yes, the pattern is repeated and the second code works great.

I spend some times trying to figure out how to make the first code working on repeated pattern,

but seems I need to improve my skill :( and bump, like you can read my mind, you post the second code o:)

Thanks a lot, Kylomas :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Great, I'm glad it worked.

Enjoy your beautiful island...

kylomas

edit: spelling

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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