-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a5bbbf
commit 440e760
Showing
1 changed file
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,13 +32,19 @@ import "Text.Regex.TDFA" | |
= Basics | ||
@ | ||
>>> let emailRegex = "[a-zA-Z0-9+.\\_-]+\\@[a-zA-Z-]+\\.[a-z]+" | ||
>>> "my email is firstname-[email protected]" =~ emailRegex :: Bool | ||
>>> let emailRegex = "[a-zA-Z0-9+._-]+\\@[-a-zA-Z]+\\.[a-z]+" | ||
>>> "my email is first-name.[email protected]" =~ emailRegex :: Bool | ||
True | ||
>>> "invalid@mail@com" =~ emailRegex :: Bool | ||
False | ||
>>> "[email protected]" =~ emailRegex :: Bool | ||
False | ||
>>> "#@invalid.com" =~ emailRegex :: Bool | ||
False | ||
/-- non-monadic/ | ||
λ> \<to-match-against\> '=~' \<regex\> | ||
|
@@ -151,6 +157,12 @@ just [a]. The character classes like [:alnum:] are supported over | |
ASCII only, valid classes are alnum, digit, punct, alpha, graph, | ||
space, blank, lower, upper, cntrl, print, xdigit, word. | ||
@ | ||
>>> getAllTextMatches ("john anne yifan" =~ "[[:lower:]]+") :: [String] | ||
["john","anne","yifan"] | ||
@ | ||
This package does not provide "basic" regular expressions. This | ||
package does not provide back references inside regular expressions. | ||
|