RegEx to find text in a map
Posted: Wed Jul 18, 2018 10:42 pm
Hi folks,
I'm terrible at RegEx and I'm hoping someone here can help me. I have a bunch of maps that have topicrefs that contain two elements, a difficulty and a topicsubject, like this:
Each map could have one or a hundred of these topicrefs. I'm trying to do a find that will give me each one of these as a separate result. I have tried a variety of regex, but each time, the result gives me the first <topicref all the way down to the last </topicref>, so it's not terribly helpful. This is the code I've been using:
Does anyone have any tips on how to have each <topicref> container return a result?
Thanks!
Peyton
I'm terrible at RegEx and I'm hoping someone here can help me. I have a bunch of maps that have topicrefs that contain two elements, a difficulty and a topicsubject, like this:
Code: Select all
<topicref href="../questions/cfaL1_question_00086_13.dita">
<topicsubject keyref="cfa_l1_los_567"/>
<difficulty value="intermediate"/>
</topicref>
Code: Select all
(topicref href=").*[">][\r\n][ ]*(<topicsubject keyref=").*["\/>][\r\n][ ]*(<difficulty value=").*[">][\r\n][ ]*(<\/topicref>)
Thanks!
Peyton