Ooba script pattern - regexp puzzle
#1
phunck, thanks for such a wonderful script! ooba is my new best friend and i intend to contribute by submitting some patterns.

there is somethig that puzzles me as i am trying to understand the regexp notations in teh included menu.xml file. in the following code:

Quote:<action type="submenu">
<url><![cdata[^http://news.bbc.co.uk/.*/nb_rm_default]]></url>
<linkpattern>
<pattern><![cdata[<a href="(?p<url>[^"'<>]+)"\s+class="story">(?p<title>[^<>]+)</]]></pattern>
</linkpattern>
</action>

inside the <pattern> element, the part ?p<url>[^"'<>]+ is totally new to me. i know the ?p<url> is essentially giving whatever matches next a named identifier called url, but what follows, that is, [^"'<>]+ is very new to me. it is basically an attempt to match the url address of a resource enclosed in "s inside an href tag, but i don't see how it works. it's used repeatedly in a lot of patterns in the menu.xml file for ooba and it works. i just don't know how or why. what does this syntax mean?

any insights will be very much appreciated

cheers

shah
Reply
#2
nevermind, after burning a lot of neurons i have found the answer. the ["'<>]+ pattern matches a sequence as long as it doesn't contain a " or a ' or < or > which is basically the url string inside the doubel quotes.

cheers

shah
Reply

Logout Mark Read Team Forum Stats Members Help
Ooba script pattern - regexp puzzle0