Elm Exactly
Results / elm-regex /

RegexFindTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`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 ms
Output
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 ms
Output
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 ms
Output
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 ms
Output
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"