Last active
August 7, 2020 18:05
-
-
Save bluepnume/e3caec919e31ecd896af2b5a26f5cb18 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* @jsx regex.node */ | |
import { regex, Regex, RegexGroup as Group, RegexText as Text, RegexWord as Word } from 'jsx-pragmatic'; | |
const email = '[email protected]'; | |
const match = email.match( | |
<Regex> | |
<Word /> | |
<Group optional> | |
<Text>.</Text> | |
<Word /> | |
</Group> | |
<Text>@</Text> | |
<Group union name='provider'> | |
<Text>paypal</Text> | |
<Text>google</Text> | |
<Text>$mail</Text> | |
</Group> | |
<Text>.</Text> | |
<Group union name='tld'> | |
<Text>com</Text> | |
<Text>org</Text> | |
<Text>net</Text> | |
</Group> | |
</Regex> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment