RegexFindTest
`Regex.find` returns one match for each non-overlapping run of the pattern. The pattern `[0-9]+` over `"abc123def456"` finds the two digit runs, so the list of matches has length 2. The contents of the matches are not checked.
Results
elm-0.19.1
passran in 67 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. find_count: 2
elm-0.19.2
passran in 45 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. find_count: 2
elm-0.19.3
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. find_count: 2
lamdera-1.5.0
passran in 77 msOutput
find_count: 2
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-regex/RegexFindTest] in its title.
Source
The -- CHECK: lines give the expected output.
module RegexFindTest exposing (main)
{-| `Regex.find` returns one match for each non-overlapping run of the pattern.
The pattern `[0-9]+` over `"abc123def456"` finds the two digit runs, so the
list of matches has length 2. The contents of the matches are not checked.
-}
-- CHECK: find_count: 2
import Html exposing (text)
import Regex
main =
let
regex = Maybe.withDefault Regex.never (Regex.fromString "[0-9]+")
matches = Regex.find regex "abc123def456"
_ = Debug.log "find_count" (List.length matches)
in
text "done"