regular expression repeating subexpression
- by Michael Z
I have the following text
<pattern name="pattern1"/>
<success>success case 1</success>
<failed> failure 1</failed>
<failed> failure 2</failed>
<unknown> unknown </unknown>
<pattern name="pattern2"/>
<success>success case 2</success>
<otherTag>There are many other tags.</otherTag>
<failed> failure 3</failed>
And the regular expression <failed>[\w|\W]*?</failed> matches all the lines contains failed tag.
What do I need to to if I want to include the lines contains pattern tag as well?
Basically, I want the following output:
<pattern name="pattern1"/>
<failed> failure 1</failed>
<failed> failure 2</failed>
<pattern name="pattern2"/>
<failed> failure 3</failed>
I am doing this in javascript, I do not mind of doing some intermediate steps.