Jump to content

String Manipulation (RegEX ??) question


Go to solution Solved by kylomas,

Recommended Posts

  • Solution

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

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

Link to comment
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 :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...