The string to be scanned. If not a string,
it will be converted using toSAtring()
Returns the index
th capture from the most recent match (or null
if
there is no recent match).
Returns the most recently matched portion of the source string (or
null
if there is no recent match).
Returns the portion of the source string immediately following the most
recent match. (Returns null
if there is no recent match.)
The getPreMatch
, getMatch
, getPostMatch
and getCapture
methods
provide information about the most recent match.
Returns the portion of the source string leading up to, but not
including, the most recent match. (Returns null
if there is no recent
match.)
Returns the scanner's position. In the reset position, this value is zero. In the terminated position, this value is the length of the source string.
Returns the portion of the source string from the scanner's position onward.
The getSource
, getRemainder
, getPosition
and hasTerminated
methods provide information about the scanner's source string and
position.
Returns the scanner's source string.
Checks to see if the scanner has reached the end of the string.
The check
, checkUntil
and peek
methods look for matching strings
without advancing the scanner's position.
Checks to see if regexp
can be matched at the current position and
returns the matched string without advancing the scanner's position, or
returns null
if there is no match.
Checks to see if regexp
can be matched at or after the current
position. Returns the portion of the source string after the current
position up to and including the end of the match without advancing the
scanner's position, or returns null
if there is no match.
Returns the next length
characters after the current position. If
called without a length
, returns the next character. The scanner's
position is not advanced.
Appends string
to the scanner's source string. The scanner's position
is not affected.
The reset
, terminate
, concat
and unscan
methods let you change
the state of the scanner.
Resets the scanner back to its original position and clears its match data.
Advances the scanner position to the end of the string and clears its match data.
Sets the scanner's position to its previous position and clears its match data. Only one previous position is stored. Throws an exception if there is no previous position.
The scan
, scanUntil
, scanChar
, skip
, and skipUntil
methods look
for matching strings and advance the scanner's position. The scan
methods return the matched string; the skip methods return the number
of characters by which the scan position advanced.
Matches regexp
at the current position. Returns the matched string
and advances the scanner's position, or returns null
if there is no
match.
Scans one character, returns it, and advances the scanner's position.
Matches regexp
at or after the current position. Returns the
portion of the source string after the scanner's position up to and
including the end of the match and advances the scanner's position,
or returns null
if there is no match.
Skips over the given regexp
at the current position. Returns the
length of the matched string and advances the scanner's position, or
returns null
if there is no match.
Skips over the given regexp
at or after the current position.
Returns the length of the string up to and including the end of the
match and advances the scanner's position, or returns null
if there
is no match.
Generated using TypeDoc
Create a new StringScanner containing the given string.