JanetDocsPlaygroundI'm feeling luckyGitHub sign in

peg/find



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

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

    Find first index where the peg matches in text. Returns an integer, 
    or nil if not found.


3 examplesSign in to add an example
Loading...
(peg/find ':a "Battery temperature: 40 °C")

# => 0 index of the first upper/lower case character

# :a (range "az" "AZ")
jgartePlayground
(peg/find ':s "Battery temperature: 40 °C")

# => 7 index of the first whitespace character

# :s (set " \t\r\n\0\f\v")

jgartePlayground
(peg/find ':d "Battery temperature: 40 °C")
# => 21 index of the first number
pepePlayground