setAnchored

setAnchored(enable: Boolean): JadeRegexPattern;

This fluent‑style method returns its own modified receiver, to allow call chaining. (By default, matches are not anchored.)

Call the setAnchored method of the JadeRegexPattern class with the enable parameter set to true to specify that matching is done only at the first position in a string.

The following is an example of the setAnchored method.

setAnchoredExample();
vars
    pattern : JadeRegexPattern;
    results : JadeRegexResult;
begin
    create pattern;
    pattern.setAnchored(true).compile("[\w]+");
    pattern.findAll("the quick brown fox", results);
    // writes 1 because only one word "[\w]+" is at the start of the line.
    write results.numMatches;
epilog
    delete pattern;
    delete results;
end;

You can set the anchoring of a Regex pattern before or after you call the compile method.

2020.0.01 and higher