Kaya 0.5.2 reference for Regex::matchOnly

List of functions and data types in Regex

Match matchOnly(Regex x, String str)

Arguments

Usage

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.

Related

kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya