y2p
y2p

Reputation: 4941

Removing a pattern from text

I have a whole bunch of text. In between (random) there is something like [7] or [23] (citation references). I just want to remove these references, where ever they occur and keep the text.

If if do something like [\\[0-9\\]] it takes each bracket separately and the number separately. How can I match the whole thing as one group and remove it from the whole text?

Thanks

Upvotes: 0

Views: 174

Answers (2)

3urdoch
3urdoch

Reputation: 7342

I think you have your backslashes in the wrong place, needs to be this and have a plus sign to allow for multi digit numbers

\\[[0-9]+\\]

Upvotes: 1

Howard
Howard

Reputation: 39217

The regex \\[[0-9]+\\] should work for your case (any number of digits between square brackets).

Upvotes: 4

Related Questions