2

I'm trying to select text between ></ . Example below I want "text"

>text</

but I'm unable to do so. tried the following but it doesn't like the slash at the end of the regex

\>(.*?)\<\

I'm trying to do this in TextPad. How is this supposed to be done? I'm ultimately wanting to delete all text between these two characters so all I'm left with is something like: <element></element>

Evan Davis
  • 35,493
  • 6
  • 50
  • 57
user1899872
  • 127
  • 2
  • 4
  • 15

3 Answers3

0

You are close.. use the following:

(>).*?(<\/)

And replace with \1\2

See DEMO

OR

You can use lookbehind and lookaheads:

(?<=>)(.*?)(?=<\/)

And replace with '' (empty string)

See DEMO

karthik manchala
  • 13,492
  • 1
  • 31
  • 55
0

RegEx wise, you can use 3 groupings and for the replace only use the first and 3rd group: \1\3.

Find: (>)(.*)(</)   
Replace: \1\3
Laz Padron
  • 26
  • 4
0

Try doing:

\>(.*?)\<\/

The regex that you were trying would actually have given error because you had a \ and nothing after that.

Rakholiya Jenish
  • 3,165
  • 18
  • 28