Reputation: 5820
I'm spamming the forum full of questions about Regex, but I really need your help.
I have the following file:
<!-- Defines the template for the tabs. -->
<div class="tabs">
<ul role="tablist">
{{BOS:Sequence}}
<li role="tab" class="{{TabType}}" id="{{tabId}}">
<span>{{TabFile}}</span>
</li>
{{EOS:Sequence}}
</ul>
</div>
Now, I want everything between the {{BOS:Sequece}} and {{EOS:Sequence}}, the tags can be included, I can filter them out.
I've comed up with the following regex:
({{BOS:Sequence}})[.]*[\s\S]*({{EOS:Sequence}})
This is working correctly, BUT...
However, when my contents change to the following
<!-- Defines the template for the tabs. -->
<div class="tabs">
<ul role="tablist">
{{BOS:Sequence}}
<li role="tab" class="{{TabType}}" id="{{tabId}}">
<span>{{TabFile}}</span>
</li>
{{EOS:Sequence}}
</ul>
</div>
{{BOS:Sequence}}
<li role="tab" class="{{TabType}}" id="{{tabId}}">
<span>{{TabFile}}</span>
</li>
{{EOS:Sequence}}
Then the regex would match:
{{BOS:Sequence}}
<li role="tab" class="{{TabType}}" id="{{tabId}}">
<span>{{TabFile}}</span>
</li>
{{EOS:Sequence}}
</ul>
</div>
{{BOS:Sequence}}
<li role="tab" class="{{TabType}}" id="{{tabId}}">
<span>{{TabFile}}</span>
</li>
{{EOS:Sequence}}
Any idea on how to solve this particular issue?
P.S: I'm writing javascript regex.
Upvotes: 0
Views: 68
Reputation: 785266
Your regex should be:
{{BOS:Sequence}}[\s\S]*?{{EOS:Sequence}}
Upvotes: 2