Highlight regex matches in a given piece of text. This is most easily explained with an example:
import Regex exposing (regex)
import Html.Attributes exposing (class)
matchText
[class "match"]
(regex "the")
"the quick brown fox jumped over the lazy dog"
=>
[span [class "match"] [text "the"]
,text " quick brown fox jumped over "
,span [class "match"] [text "the"]
,text " lazy dog"]
Now you can add a CSS rule like `.match {background-color: yellow;}` to highlight matches
for the user.
(Note that you can supply any attributes you like for the matched sections, or an empty list.)
Highlight regex matches in a given piece of text. This is most easily explained with an example: