[Greasemonkey] Pattern matching on an attribute?

Geir Aalberg geir at fandom.no
Thu Apr 20 15:01:15 EDT 2006


on 04/19/2006 09:55 PM Sean LeBlanc said the following:
> I'm trying to figure out how I might pattern match on an attribute. 
> 
> Something like:
> 
> document.evaluate('//img[@src="foo*"]'), 
>  document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
>  null );

What you want is regular expressions. Unfortunately, they are only planned 
for XPath 2.0. Until then, use standard string-matching methods like 
starts-with() and contains().

-geir


More information about the Greasemonkey mailing list