-4

Using a regular expression, how can I find everything in between <p and </A> and replace it with just <p> in the following string. (The contents between <p </A> is never the same, so I just need to get everything and delete it).

 <p TITLE="Super Sent., lib. 3 d. 6 q. 1 a. 2 arg. 3"><A NAME="8220"><SPAN CLASS="ref">[8220] Super Sent., lib. 3 d. 6 q. 1 a. 2 arg. 3 </SPAN></A>

In short I want to replace all instances of the above with just: <p>

Jeff
  • 3,943
  • 8
  • 45
  • 68
  • What is expected output exactly? Please add it to your question – Shafizadeh Feb 25 '16 at 22:39
  • That's a really simple pattern, so it's not clear which part of it you are having trouble with. What specifically is the question? – Steven Doggart Feb 25 '16 at 22:42
  • Regex is not a good [tool for parsing HTML](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – Joe Feb 25 '16 at 22:43
  • *how can I find everything in between `

    ` and replace it with just `

    `*, Then expected result is this `

    ` ? I hardly think so ..

    – Shafizadeh Feb 25 '16 at 22:47

1 Answers1

0

I'm not sure I get you right or not, but I guess you need something like this:

(<p).*?(<\/A>)

Online Demo

Shafizadeh
  • 9,960
  • 12
  • 52
  • 89