I have a line:
123 df456 555 [ 789 ] [abc 1011 def ] [ ghi 1213] [jkl mno 1415 pqr] 161718 jkl 1920
I need to get only numbers that do not fit between square brackets [ ]. All the numbers given that I need to place inside The square brackets [ ]
correct result should be:
[123] df456 [555] [ 789 ] [abc 1011 def ] [ ghi 1213] [jkl mno 1415 pqr] [161718] jkl [1920]
I tried to write a JavaScript regular expression like this:
/(?!\[(.*?)\])((\s|^)(\d+?)(\s|$))/ig
but it seems wrong, it seems that a positive look has more priority than a negative result.
source
share