Home > Mobile >  Consult a string with a regular expression to replace below
Consult a string with a regular expression to replace below

Time:09-17

For example: [bkid=nae="full" xi] [bkid=1421817, bknae="city"] [bkid=158979, bknae="day clothes much mei"]

Full string: cece saaa test [test] guessing, guessing guessing guessing on [bkid=nae="full" xi] [bkid=1421817, bknae="city"] [bkid=158979, bknae="day clothes much mei"] la la la la la la la la s s, la cool cool cool water water water water water d

Results: test saaa test [test] guessing, guessing guessing guessing on la la la la la la la la, s s! Cool cool cool water water water water water d





Thanks for your bosses!

CodePudding user response:

Are you trying to get rid of the middle of the []
?Direct regular \ [*? \] had replaced completely disappear
 "cece saaa test [test] guessing, guessing guessing guessing on [bkid=nae=" full "xi] [bkid=1421817, bknae=" city "] [bkid=158979, bknae="day clothes much mei"] la la la la la la la la s s, cool cool cool water water water water water d ". The replace (/\ [. *? \]/g, ""); 

Output:
"Cece saaa cece guessing, guessing guessing guessing on la la la la la la la la, s s cool cool cool water water water water water d"

CodePudding user response:

Normal text may also be covered []

The idea is to replace the format inside and bkid bknae [bkid=1421817, bknae="city"]
  • Related