Match matchOnly(Regex x, String str)
x: A compiled regular expression
str: The String to match
Attempt to match a compiled regular expression to a string, returning a Match object.
r = compile("s$"); s1 = "sausages"; m1 = match(r,s1); // matches(["s"],"sausage","") s2 = "a sausage"; m2 = match(r,s2); // noMatch
This will only return the match in the match object, and not the strings before and after the match - this is more efficient because it does not need to construct new strings.
str may be a Tainted string, and the strings in the Match object will not be tainted.