I am looking for a regex to use in Notepad++ for deleting all square brackets and their contents, as well as any occurrence of a comma or hyphen that follows the closed bracket. The regex should detect the following examples inside the text for removal:
[1]–[5]
[Alibaba], [7], [8]
[1-2]–[5]
I don't care about the spaces after comma and they can stay.
So far I could catch the brackets and their content by \[[^\]]*\]
.
You can extend your regex this way to capture following comma and hyphen:\[[^\]]*\](?:,|-)?