How do I remove the special characters [ and ] below using regex, while preserving the square brackets at the back of the sentence?
From
468620188,[2012-07-07 00:00:00,057],[Thread-20],INFO,BIZ,Handler,getJobs,[Result] Retrieving broadcast []
To
468620188,2012-07-07 00:00:00,057,Thread-20,INFO,BIZ,Handler,getJobs,[Result] Retrieving broadcast []
This works with perl REs, using a lookahead:
s/[\[\]](?=.*,)//g;
It removes any [
or ]
character that has a ,
character somewhere after it.
If you're not using perl, this probably won't be as useful.
This might work:
\[([^\n]*,)
, replace with \1
. Hit Replace All\]([^\n]*,)
, replace with \1
. Hit Replace All.Please note I don't have access to Notepad++ to test this; I'm just going off some screen shots of the search box I found online.