More Regex help (if possible?)
Posted: 09 Aug 2010 17:18
Hi all,
I was a little unsure about posting this, because this isn't a Regex forum! Having said that, I haven't found as much help on anything anywhere else
Anyway, in case someone can point me in the right direction, here's what is driving me nuts:
I have a group of folders with names like these
What I'd like to do is remove everything inside the "[]" brackets, including the brackets themselves
The Regex pattern I've been experimenting with is:
This actually works no problem (I can remove any generated double spaces later with a simple 'search and replace') EXCEPT when the text inside brackets *** is at the very end *** of the string . . . then it just gets ignored, so my result using this Regex is
As you can see, the second string remains untouched
Has anyone any ideas? I do understand if you don't have time and I'll keep searching, but I'd be grateful for a pointer in the right direction
My ultimate aim is to write a Regex pattern that will match anything in [] or () brackets and remove them all in one go, but I can see the use of having this as two seperate patterns becase removing both might not always be needed
Thanks
Biggy
I was a little unsure about posting this, because this isn't a Regex forum! Having said that, I haven't found as much help on anything anywhere else
Anyway, in case someone can point me in the right direction, here's what is driving me nuts:
I have a group of folders with names like these
Code: Select all
Elton John - Best of [128kbs] live in London
Simple Minds Waterfront Collection [mp3]
Enya [320] Hits and Remixes
The Regex pattern I've been experimenting with is:
Code: Select all
(.+)\[.+](.+)
match everything until the first '[' ---> (.+)\[
then match everything until the ']' ---> .+]
then match everything else ---> (.+)
replace with $1$2
Code: Select all
Elton John - Best of live in London
Simple Minds Waterfront Collection [mp3]
Enya Hits and Remixes
Has anyone any ideas? I do understand if you don't have time and I'll keep searching, but I'd be grateful for a pointer in the right direction
My ultimate aim is to write a Regex pattern that will match anything in [] or () brackets and remove them all in one go, but I can see the use of having this as two seperate patterns becase removing both might not always be needed
Thanks
Biggy