Subject: Return the string that matches earliest -- Got a slick XPath expression that solves this?
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Sun, 24 Nov 2013 17:32:02 +0000
|
Hi Folks,
I have a pattern matching problem. It is explained easiest with an example.
Example:
Here is a string: aabQc
Let's call it the sentential string.
Do any of the following strings occur in
the sentential string:
bQc
cQ
Let's call those strings the LHS strings.
Clearly both LHS strings are contained
in the sentential string. But bQc occurs
earlier, so that is the correct answer.
Problem: Given a sentential string and a sequence of LHS strings, return the
LHS string that occurs earliest in the sentential string. If multiple LHS
strings occur earliest then return them all. Let $sentential be the sentential
string and $LHS be a sequence of one or more LHS strings.
I'll bet there's a slick XPath expression that solves this problem.
Would you provide an XPath expression that solves this pattern matching
problem please?
/Roger
|