Jump to content
Sign in to follow this  
barryb

String replace question [SOLVED]

Recommended Posts

barryb

Hi,

This is probably going to be easy to answer, but I can't figure it out. My script quite happily uses _StringBetween to do a search and replace,

$aArray = _StringBetween($sText, $start, $end)

but I have an issue where I need to extend what is being replaced in the search and replace. My current search and replace parameters happily identifies and replaces the different www.example.com entries with $end = "/" but I need to expand it to also replace text to the second "/" such as URL /TextToReplace/ but the TextToReplace can be different e.g.

www.example.com/TextoToReplace/DontReplace

www.example.com/ABC/DontReplace

www.example2.com/DEF/DontReplace

www.example3.com/GHI/DontReplace

I tried wildcard but that didn't work as it is taken as a literal character. Any help appreciated :)

Thanks,

Barry

Edited by barryb

Share this post


Link to post
Share on other sites
barryb

Hi,

Think I worked it out myself, I created another search array to find and replace against the tail end of .com/ and / and that appears to have worked :)

$bArray = _StringBetween($sText, $start2, $end2)

will need to do far more testing though!!

Cheers,

Barry

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  

×