Remove special characters between digits up to a limit using regex -


How can I remove special characters [and] using regex while preserving the square bracket behind the sentence?

from

  468620188, [2012-07-07 00: 00: 00,07], [thread-20], INFO, BIZ, handler, getzobs, [result] Receiving the broadcast []   

To

  468620188,2012-07-07 00: 00: 00,057, thread-20, info, biz, handler, Getgebes, [result] Recovering broadcast []  

It works with perl RE, using: < Previous> s /[*[\]](?=.*))// g;

This removes any [ or ] character in which the code follows , .

If you are not using a pearl, then maybe this will not be useful.


Edit:

This can work:

  1. \ [([^ \ n] *,) Search for , replace with \ 1 . Change all
  2. \] ([^ \ n] *,) to search, replace with \ 1 . Change all.

    Please note that I do not have access to Notepad ++ to check it out; I'm just removing some screen shots from the online search box.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -