sql - xQuery LIKE-operator? -
is there way perform operation xquery in same way sql?
i wan't construct "startswith", "endswith" , "contains"-expressions.
example of want achieve:
for $x in /user $x/firstname '%xxx' return $x $x in /user $x/middlename 'xxx%' return $x $x in /user $x/lastname '%xxx%' return $x
is there way achieve in xquery?
edit:
got answer question above. new problem:
would there way opposite way around? run queries sql equivalent not operator. possible? has in flwor-expression
edit2:
solved problem. can run fn:not(starts-with('123', '1')) , returns false.
xpath 2.0 , xquery 1.0 (as standardized w3c) have regular expression support matches
function http://www.w3.org/tr/xpath-functions/#func-matches:
/user[matches(firstname, 'xxx$')]
and of course there functions starts-with
, contains
(both in xpath 1.0/2.0), , ends-with
(only in xpath 2.0) might suffice.
Comments
Post a Comment