0

I need a pattern / search string to remove everything between the "[" and "]" characters. An example would be:

This study  [ref] is  a good example

This should become:

This study  is  a good example

I found this regex here \<(*{1,})\> but although it works with < and >, it doesn't with [ and ].

When I use \[(*{1,})\] world "says" that they can't find what I am looking for.

I am trying to remove some formatings from wikipedia articles and this regex doesn't remove the [edit] next to the headings. (I use the merge formating paste)

MagTun
  • 1,598

1 Answers1

2

This two expressions work

\[*\]
\[[a-zA-Z ]{1,}\]

Further comments:

  • * represents an arbitrary number of string characters. {1,} can only be attached to a single character wildcard. That is the problem with the expression \[*{1,}\].
  • The ( and ) are not necessary.

See https://support.office.com/en-ca/article/Use-wildcard-characters-to-find-or-replace-text-610e37dc-bb2f-4a8b-8fa5-aa991160eafb for details on the wildcards.