I am using an application required by this project that must utilize regular expression inputs to pre-filter data that may come in the from of html / javascript.
I have read the article decrying the use of regex filtering html; I however must in this situation.
The issue I need help with (which seems like can not easily be explained) is finding the TAGS that contain within data_1.
<TAG>
.
..
...
data_1
...
..
.
</TAG>
I have tried many different approaches however my overall experience with regex is limited.
Example 1:
\<TAG.*\bdata_1\b.*?/TAG\>
Does not work as it actually grabs the first that exists passing by /TAG> until it finds “data_1” then ends at the next following /TAG>
I know I am currently on the right track, I however started learning Regex about 2 days ago and am not quite there yet.
Any links, comments, advice would be most appreciated.
Edit
It still selects all preceding TAGS.
***BEGIN***
<TAG>
....
.....
</TAG>
<TAG>
...
data_1
...
</TAG>
***END***
When it should be:
<TAG>
....
.....
</TAG>
***BEGIN***
<TAG>
...
data_1
...
</TAG>
***END***
This regex would probably work:
You can see the result here: http://regexr.com?2v5qt