JanetDocsPlaygroundI'm feeling luckyGitHub sign in

peg/find-all



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

    (peg/find-all peg text &opt start & args)

    Find all indexes where the peg matches in text. Returns an array of 
    integers.


5 examplesSign in to add an example
Loading...
(peg/find-all ~(capture (range "09"))
              "hi 0 bye 1")
# => @[3 9]
sogaiuPlayground
(peg/find-all ~(capture ,(get default-peg-grammar :d))
              "hi 0 bye 1")
# => [3 9]
sogaiuPlayground
(peg/find-all ~(capture :d)
              "hi 0 bye 1")
# => @[3 9]
sogaiuPlayground
(peg/find-all ':d "Battery temperature: 40 °C")

# => @[21 22] indices containing digits

# :d (range "09")

# peg grammars are contained in a table @{} (mutable) located in boot.janet source file.

jgartePlayground
(peg/find-all ':d "hi 1 bye 2") # => @[3 9]
pepePlayground