Regex Cheat Sheet Regex Tutorials Regex Forums Regex Book
URL SOURCE:   FILE SOURCE:

MATCH PATTERN:

REPLACEMENT PATTERN:

OPERATION: # # USE .NET FLAGS: i
x
m
s
 Help SHOW MATCH ARRAY:    EXPLAIN:  OPTIMIZE:    SHOW CODE: PHP
ASP
VB.NET
C#.NET
Java
JS
DELIM: HIGHLIGHT MATCHES:      GEN SAMPLES:   
    Save example     Help     FROM: TO: 

PASSWORD RESTRICTIONS:

Allow only these characters:  (any character)  ]
At Least  Total Characters
No More Than   Total Characters
At Least  Lowercase Characters (a-z)
At Least  Uppercase Characters (A-Z)
At Least  Numeric Characters (0-9)
At Least  Special Characters in [^a-zA-Z0-9]  ]
Disallow sequential alphanumeric sequences of or more (i.e. 123... abc... ABC...)
Disallow repeating characters of or more (i.e. 11... aa... AA... %%...)

WORD LIST:



SOURCE TEXT:

HIGHLIGHTED MATCHES:

CAPTURE GROUPS Help
0
 
1 : 'mailbox'
 
2 : 'name_addr'
 
3 : 'display_name'
 
4 : 'phrase'
 
5 : 'word'
 
6 : 'atom'
 
7 : 'CFWS'
 
8 : 'CFWS_1'
 
9 : 'FWS'
 
10 : 'WSP'
 
11 : 'comment'
 
12 : 'ccontent'
 
13 : 'ctext'
 
14
 
15 : 'quoted_pair'
 
16 : 'text'
 
17
 
18
 
19 : 'atext'
 
20 : 'quoted_string'
 
21 : 'qcontent'
 
22 : 'qtext'
 
23 : 'angle_addr'
 
24 : 'addr_spec'
 
25 : 'local_part'
 
26 : 'dot_atom'
 
27 : 'dot_atom_text'
 
28 : 'domain'

"Fred FlintStone" <YabbaDabbaDoo!@BedRock.com>

RESULTS:

Execution Time(sec.):
0.000079

Raw Match Pattern:
^(?P<mailbox>(?P<name_addr>(?P<display_name>(?<phrase>(?P<word>(?P<atom>(?P<CFWS>(?P<CFWS_1>(?P<FWS>(?:(?P<WSP>\x20|\x09)*|\r\n)?(?P>WSP)+)?(?P<comment>\x28(?:(?P>FWS)?(?P<ccontent>(?P<ctext>((?![\s()\\])[\x01-\x7f]))|(?P<quoted_pair>\\(?P<text>(?![\n\r])[\x01-\x7f]))|(?:\x28(?:(?P>FWS)?(?P>ctext)|(?P>quoted_pair))(P>FWS)?\x29)))*(P>FWS)?\x29))*(?:(?P>CFWS_1)|(?P>FWS)))?(?P<atext>(?!["()<>\[\]:;@\\,.])[\x21-\x7E])+(?P>CFWS)?)|(?P<quoted_string>(?P>CFWS)?\x22(?:(?P>FWS)?(?P<qcontent>(?P<qtext>(?![\t\n\r\x20\x22\x5c])[\x01-\x7f])|(?P>quoted_pair)))*(?P>FWS)?\x22(?P>CFWS)?))+))?(?<angle_addr>(?P>CFWS)?\x3c(?P<addr_spec>(?P<local_part>(?P<dot_atom>(?P>CFWS)?(?P<dot_atom_text>(?P>atext)+(?:\.(?P>atext)+)*)+(?P>CFWS)?)|(?P>quoted_string))@(?P<domain>(?P>dot_atom)|(?P<domain_literal>(?P>CFWS)?\x5b(?:(?P>FWS)?(?P<dcontent>(?P<dtext>(?![\t\r\n\x20\[\]\\])[\x01-\x7F])|(?P>quoted_pair)))*(?P>FWS)?\x5d(?P>CFWS)?)))\x3e(?P>CFWS)?))|(?P>addr_spec))$

PHP Code Example:
 
<?php
$sourcestring="your source string";
preg_match('/^(?P<mailbox>(?P<name_addr>(?P<display_name>(?<phrase>(?P<word>(?P<atom>(?P<CFWS>(?P<CFWS_1>(?P<FWS>(?:(?P<WSP>\x20|\x09)*|\r\n)?(?P>WSP)+)?(?P<comment>\x28(?:(?P>FWS)?(?P<ccontent>(?P<ctext>((?![\s()\\])[\x01-\x7f]))|(?P<quoted_pair>\\(?P<text>(?![\n\r])[\x01-\x7f]))|(?:\x28(?:(?P>FWS)?(?P>ctext)|(?P>quoted_pair))(P>FWS)?\x29)))*(P>FWS)?\x29))*(?:(?P>CFWS_1)|(?P>FWS)))?(?P<atext>(?!["()<>\[\]:;@\\,.])[\x21-\x7E])+(?P>CFWS)?)|(?P<quoted_string>(?P>CFWS)?\x22(?:(?P>FWS)?(?P<qcontent>(?P<qtext>(?![\t\n\r\x20\x22\x5c])[\x01-\x7f])|(?P>quoted_pair)))*(?P>FWS)?\x22(?P>CFWS)?))+))?(?<angle_addr>(?P>CFWS)?\x3c(?P<addr_spec>(?P<local_part>(?P<dot_atom>(?P>CFWS)?(?P<dot_atom_text>(?P>atext)+(?:\.(?P>atext)+)*)+(?P>CFWS)?)|(?P>quoted_string))@(?P<domain>(?P>dot_atom)|(?P<domain_literal>(?P>CFWS)?\x5b(?:(?P>FWS)?(?P<dcontent>(?P<dtext>(?![\t\r\n\x20\[\]\\])[\x01-\x7F])|(?P>quoted_pair)))*(?P>FWS)?\x5d(?P>CFWS)?)))\x3e(?P>CFWS)?))|(?P>addr_spec))$/x',$sourcestring,$matches);
echo "<pre>".print_r($matches,true);
?>
 

$matches Array:
(
    [0] => "Fred FlintStone" <YabbaDabbaDoo!@BedRock.com>
    [mailbox] => "Fred FlintStone" <YabbaDabbaDoo!@BedRock.com>
    [1] => "Fred FlintStone" <YabbaDabbaDoo!@BedRock.com>
    [name_addr] => "Fred FlintStone" <YabbaDabbaDoo!@BedRock.com>
    [2] => "Fred FlintStone" <YabbaDabbaDoo!@BedRock.com>
    [display_name] => "Fred FlintStone" 
    [3] => "Fred FlintStone" 
    [phrase] => "Fred FlintStone" 
    [4] => "Fred FlintStone" 
    [word] => "Fred FlintStone" 
    [5] => "Fred FlintStone" 
    [atom] => 
    [6] => 
    [CFWS] => 
    [7] => 
    [CFWS_1] => 
    [8] => 
    [FWS] => 
    [9] => 
    [WSP] => 
    [10] => 
    [comment] => 
    [11] => 
    [ccontent] => 
    [12] => 
    [ctext] => 
    [13] => 
    [14] => 
    [quoted_pair] => 
    [15] => 
    [text] => 
    [16] => 
    [17] => 
    [18] => 
    [atext] => 
    [19] => 
    [quoted_string] => "Fred FlintStone" 
    [20] => "Fred FlintStone" 
    [qcontent] => e
    [21] => e
    [qtext] => e
    [22] => e
    [angle_addr] => <YabbaDabbaDoo!@BedRock.com>
    [23] => <YabbaDabbaDoo!@BedRock.com>
    [addr_spec] => YabbaDabbaDoo!@BedRock.com
    [24] => YabbaDabbaDoo!@BedRock.com
    [local_part] => YabbaDabbaDoo!
    [25] => YabbaDabbaDoo!
    [dot_atom] => YabbaDabbaDoo!
    [26] => YabbaDabbaDoo!
    [dot_atom_text] => YabbaDabbaDoo!
    [27] => YabbaDabbaDoo!
    [domain] => BedRock.com
    [28] => BedRock.com
)