Let presume we have something like this:
<div1>
<h1>text1</h1>
<h1>text2</h1>
</div1>
<div2>
<h1>text3</h1>
</div2>
Using RegExp we need to get text1
and text2
but not text3
.
How to do this?
Thanks in advance.
EDIT: This is just an example. The text I'm parsing could be just plain text. The main thing I want to accomplish is list all strings from a specific section of a document. I gave this HTML code for example as it perfectly resembles the thing I need to get.
(?siU)<h1>(.*)</h1>
would parse all three strings, but how to get only first two?
EDIT2: Here is another rather dumb example. :)
Section1
This is a "very" nice sentence.
It has "just" a few words.
Section2
This is "only" an example.
The End
I need quoted words from first but not from second section.
Yet again, (?siU)"(.*)"
returns quoted words from whole text,
and I need only those between words Section1
and Section2
.
This is for the "Rainmeter" application, which apparently uses Perl regex syntax.
I'm sorry, but I can't explain it better. :)