Skip to content

Commit 3c8fc76

Browse files
committed
added match object methods
1 parent a6d3f7d commit 3c8fc76

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

docs/appendix-a-index.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ divides numbers, forces numeric context
420420
inside round brackets (for example `(3/7)`), gives you a
421421
[rational number](#Rat-type) that keeps track of its numerator and denominator
422422

423-
<a id="slash-var"/><a id="match-var"/>
423+
<a id="slash-var"/><a id="match-var"/><a id="match-object"/>
424424
**$/**
425425
*[«special var»](appendix-b-grouped.html#match-variables)* &mdash;
426-
last created match object of this
427-
*[block](appendix-g-glossary.html#block)*
426+
last created match object of this [*block*](appendix-g-glossary.html#block)
427+
with the [following methods](appendix-b-grouped.html#match-object-methods)
428428

429429
<a id="slash-slash-op"/><a id="defined-or"/>
430430
**//**
@@ -3053,8 +3053,8 @@ see also: [**numerator**](#numerator) and [**denominator**](#denominator)
30533053
Perl number (approximate "real", generally via floating point)
30543054

30553055
<a id="numerator"/>
3056-
( [--\>](#minus-minus-greater-signature) [Int](#Int-type))
30573056
**numerator**
3057+
( [--\>](#minus-minus-greater-signature) [Int](#Int-type))
30583058
*[«rat method»](tablet-2-basic-syntax.html#rational-number)* &mdash;
30593059
returns the numerator of a rational number (value type **[Rat](#Rat-type)**
30603060
and **[FatRat](#FatRat-type)**),

docs/appendix-b-grouped.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Special Variables
5555
### Match Variables ###
5656

5757
----------------------------------------------------- -----------------------------------------------------------------------------
58-
[`$/`](appendix-a-index.html#slash-var) last created match object of this block
58+
[`$/`](appendix-a-index.html#slash-var) last created match object of this [block](appendix-g-glossary.html#block)
5959
[`$<...>`](appendix-a-index.html#angle-brackets-var) alias to named capture, see Twigils above
6060
[`$0 ...`](appendix-a-index.html#0-var) alias to positional capture, like in P5 - `$1 .. $9` but doesn't stop at `$9`
6161
[`@()`](appendix-a-index.html#round-brackets-var) array that holds $0 .. $9 and rest and positional submatches
@@ -845,6 +845,20 @@ regex. They can have prefixes: . (dot) marks a non-capturing subrule,
845845
[`<!>`](#exclamation-subrule) always false
846846
----------------------------------------------- -------------------------------------------------
847847

848+
Match Object Methods
849+
--------------------
850+
851+
$/.from # the initial match position
852+
$/.to # the final match position
853+
$/.chars # $/.to - $/.from
854+
$/.orig # the original match string
855+
$/.Str # substr($/.orig, $/.from, $/.chars)
856+
$/.ast # the abstract result associated with this node
857+
$/.caps # sequential captures
858+
$/.chunks # sequential tokenization
859+
$/.prematch # $/.orig.substr(0, $/.from)
860+
$/.postmatch # $/.orig.substr($/.to)
861+
848862

849863
Flow Control
850864
============

0 commit comments

Comments
 (0)