JanetDocsPlaygroundI'm feeling luckyGitHub sign in

peg/replace



    cfunction
    src/core/peg.c on line 1739, column 1

    (peg/replace peg repl text &opt start & args)

    Replace first match of peg in text with repl, returning a new 
    buffer. The peg does not need to make captures to do replacement. 
    If no matches are found, returns the input string in a new buffer.


1 exampleSign in to add an example
Loading...
(peg/replace ~(sequence :s (thru "t")) 
             " duck"
             "smiling cat sleeps")
# => @"smiling duck sleeps"
sogaiuPlayground