Product SiteDocumentation Site

5.4.16.6. position


>>-position------------------------------------------------><

Returns the character position at which the last parse(), pos(), or match() method ended.

Example 5.200. Class REGULAREXPRESSION - position method


myRE = .RegularExpression~new
myRE~parse("[abc")                    -- illegal set definition
say myRE~position                     -- will be 4

myRE = .RegularExpression~new("[abc]12")
myRE~match("c12")
say myRE~position                     -- will be 3

myRE~match("a13")
say myRE~position                     -- will be 2 (failure to match)

::requires "rxregexp.cls"