This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
We were not able to find the expected elm-package.json file at this tag.
Tag 2.0.0
Committed At 2018-07-31 02:48:25 UTC




    VerbalExpressions is an Elm package that helps to construct difficult regular expressions.

    Other Implementations

    You can see an up to date list of all ports on


    import Regex exposing (Regex)
    import VerbalExpressions exposing (..)
    {-| Create an example of how to test for correctly formed URLs.
    urlTester : Maybe Regex
    urlTester =
            |> startOfLine
            |> followedBy "http"
            |> possibly "s"
            |> followedBy "://"
            |> possibly "www."
            |> anythingBut " "
            |> endOfLine
            |> toRegex
    {-| Use Regex.contains to determine if we have a valid URL.
        isValidUrl "" --> True
    isValidUrl : String -> Bool
    isValidUrl url =
            |> (\regex -> Regex.contains regex url)
            |> Maybe.withDefault False
    {-| Replace a string with another.
        replaceRedToBlue "We have a red house" --> "We have a blue house"
    replaceRedToBlue : String -> String
    replaceRedToBlue string =
            |> find "red"
            |> toRegex
            |> (\regex -> Regex.replace regex (\_ -> "blue") string)
            |> Maybe.withDefault string

    API differences

    The following table illustrates any differences between this package's function names and the canonical VerbalExpressions operator names, and explains the reason for the difference.

    | Operator Name | Function Name | Reason | |---------------|---------------|--------| | then | followedBy | then is a keyword in Elm, and the compiler will not allow aliasing of keywords. andThen is typically used in this scenario, but as a result has taken on an implicit use with chainable data-types like Task and Maybe. followedBy is a good synonym for the semantic meaning of the then VerbalExpressions operator. | | maybe | possibly | maybe might cause confusion due to the existence of the core Maybe type. | | or | orElse | or is already a built-in function for performing logical-or operations on Bool values. It's best practice not to alias basic functions. |

    Additionally, the following operators have been omitted for technical or conventional reasons.

    | Operator Name | Reason | |-----------------|--------| | br | Elm conventions encourage a minimal API surface, and br offers no different readability semantics from lineBreak. | | any | See above for br, as it applies to anyOf. | | stopAtFirst | Elm regular expressions handle number of matches at the function-call level, with the Regex.HowMany type, so this functionality is not supported or needed. | | searchOneLine | Elm's regular expressions do not support setting the "m" flag on their internal JavaScript representations yet. |

    This Elm package is based on the original Javascript VerbalExpressions library by jehna.