Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - looking for an an XPath/XQuery equivalent to a regexp pattern >Thread Next - Re: looking for an an XPath/XQuery equivalent to a regexp pattern Re: looking for an an XPath/XQuery equivalent to a regexp patternTo: NULL Date: 2/11/2009 5:54:00 PM S Perryman wrote: > I'm trying to construct an XPath/XQuery expression to find all > elements in an XML structure (descendents etc) that satisfy an infix > search pattern that in regexp form would be : *pattern* . > > All the refs I've got to date suggest that I might only be able > to do : > > *pattern (suffix match) > pattern* (prefix match) It is not clear to me what you want to achieve. Do you want to find elements where the name matches a certain pattern? Or elements where the contents matches a certain pattern? Also XPath 2.0 and XQuery 1.0 have regular expression support so you could do e.g. //*[matches(., 'someregularexpressionhere')] to find all elements containing a string matching the regular expression provided in the second argument to the matches function. http://www.w3.org/TR/xpath-functions/#func-matches -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
