I have a sequence of xml elements like this:
<addr>via roma</addr>
<addr>via milano</addr>
<addr>via napoli</addr>
...
and I want to check if there is a sequence of addresses containing the same consecutive address 3 or more times, like:
<addr> via napoli</addr>
<addr>via roma</addr>
<addr>via roma</addr>
<addr>via roma</addr>
<addr>via milano</addr>
....
This input sequence of xml elements is the result of xquery. I think I should use the fn:matches() function but I can’t write the regular expression that matches this sequence.
This query (and Xpath 3.0 expression) produces
true()exactly when the sequence$seqcontains $n or more consecutive items having the same string value:So, in this specific case:
produces