Grappling with an RE
Posted: Wed Feb 06, 2013 10:17 am
I'm having a bit of difficulty getting this one right and would appreciate some help please.
I want to replace lines like this
abc xyx etc [Text in square brackets]
with
Text in square brackets abc xyz etc
I can get fairly close with
Find: (.*)(\[[A-Za-z\\]+\]$)
Replace with: \2 \1
But so far I'm darned if I can remove the square brackets in the replaced string. I suppose I could simply apply two more steps to remove '[' and ']' respectively, but I'm sure it should be possible in one expression?
Note: The reason for the '\\' is that it's possible the bracketed string might contain '\' as well as 'simple' words. Ideally I'd like to allow for any special characters and numbers, but that's another complication I haven't tackled yet.
--
Terry, East Grinstead, UK
I want to replace lines like this
abc xyx etc [Text in square brackets]
with
Text in square brackets abc xyz etc
I can get fairly close with
Find: (.*)(\[[A-Za-z\\]+\]$)
Replace with: \2 \1
But so far I'm darned if I can remove the square brackets in the replaced string. I suppose I could simply apply two more steps to remove '[' and ']' respectively, but I'm sure it should be possible in one expression?
Note: The reason for the '\\' is that it's possible the bracketed string might contain '\' as well as 'simple' words. Ideally I'd like to allow for any special characters and numbers, but that's another complication I haven't tackled yet.
--
Terry, East Grinstead, UK