4

I need a pattern to remove everything between the "<" and ">" characters. An example would be:

<blah blah blah>Something I want <blah blah>really bad<blah blah>

becomes

Something I want really bad

How would I go about doing this? I have looked up the word search patterns and tried using them (to no avail). If Word won't do it, is there an online tool that could?

barlop
  • 23,380
  • 43
  • 145
  • 225
Asad-ullah Khan
  • 51
  • 1
  • 1
  • 3
  • Obligatory reference to the famous bobince answer over at StackOverflow: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – R-D Feb 08 '15 at 22:05
  • [If you're interested in a notepad++ solution](http://superuser.com/a/683194/50173) – nixda Jul 31 '15 at 22:47
  • Why can't you just replace the < and > with [ and ] ?! – barlop Dec 10 '15 at 09:15

1 Answers1

6

I need a search pattern to remove everything between the "<" and ">" characters.

  • Set "Find What" to \<(*{1,})\>

  • Set "Replace with" to an empty string.

  • Check "Use wildcard"

Notes:

  • < and > are special characters that need to be escaped using \
  • * means any character
  • {1,} means one or more times

Further reading

barlop
  • 23,380
  • 43
  • 145
  • 225
DavidPostill
  • 153,128
  • 77
  • 353
  • 394
  • Your code works for `<` and `>` but it doesn't seem to work with `[` and `]` When I use wildcard with this : `\[(*{1,})\]` word can't find anything but if I only look for `[` or `]` without wild card, all the `[` and `]` are found. Any idea why? ( I tried with and without the `\` to escape the `[` and `]` ). Thanks for your help! – MagTun Dec 10 '15 at 06:47
  • This is a different question to the OP. Please ask your own question and include examples of the text before and after you required changes. – DavidPostill Dec 10 '15 at 08:26
  • Sorry for this, here is my question: http://superuser.com/questions/1011506/remove-of-everything-between-and-in-word-regex – MagTun Dec 10 '15 at 08:50