Your lookahead conditionals guess might be correct:My best guess is that it involve lookaheads, but although I've read some tutorials, I can't seem to come up with the answers.
https://docs.rainmeter.net/tips/webparser-lookahead-assertions-in-regexp/ (the short and simple version)
https://docs.rainmeter.net/tips/rss-feed-tutorial/ (the long and complex version)
although you might need some branch reset parts too:
https://www.rexegg.com/regex-disambiguation.php#branchreset
especially for the <warnings/> self-closing tag, which doesn't entirely follow the typical opening and closing tags syntax:
https://developer.mozilla.org/en-US/docs/Glossary/Void_element#self-closing_tags
This one is tricky, because regex needs to know the "boundaries" of what it captures, i.e. "from where" and "to where". If the "section" - including its tags! - is entirely absent, how would the regex engine know where to start and where to end that capture? Sure, you could go with the ending tags of a preceding element and the starting tag of a succeeding one, but are you sure you can count on their order so you can identify them?or it may be entirely absent
Based on this, I believe that what you need are branch reset groups, since lookahead conditionals will not make the capture if the conditional part isn't true (in other words, their usage is suited for "skipping" things that don't exist). For example (see the info on the left sidebar too, one of the things I like about that site - clear and short info with just one example)...so that the number of captures remains the same
1) the <precipitation> tag exists, all 3 tag contents are captured, via the standard matching: 2) the <precipitation> tag doesn't exist, no tag contents is captured, via the standard matching: 3) the <precipitation> tag doesn't exist, but an empty string is captured, via a branch reset group: The branch reset group used above was (?|<precipitation.*>(.*)<\/precipitation.*>|()) but it can obviously be adjusted to have as many "branches" capturing something under the same capture number (e.g. starting and ending tags, self-closing tags, no tags at all, etc).
Statistics: Posted by Yincognito — Today, 10:12 pm