peg-replace ( string parser -- result )


Vocabulary
peg.search

Inputs
stringa string
parsera peg based parser


Outputs
resulta string


Word description
Returns a copy of the original string but with all substrings that successfully parse with the given parser replaced with the result of that parser.
USING: math math.parser peg peg.parsers peg.search prettyprint ; "one 123 two 456" integer-parser [ 2 * number>string ] action peg-replace .
"one 246 two 912"


See also
peg-search

Definition