Regular Expressions 101

Save & Share

  • Regex Version: ver. 13
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
No Match

r"
"
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression. sed -E 's/(,""38,602"",) /\1\n/gm;t' <<< "Benjamin Sosa 1 (825) 828-0003 Wanda's Vocal Coaching 207-LARYNX-1 Taste of Mexico Restaurant 418TAMALE9 Hope Tyler 515.720.3628 Bernadette Stanley 226-850-6891 Omar Sullivan 1 (970) 641▪5436 Tamera Norton 1*770*285*0559 Marcy Albert (527) 664-4544 Carl Velez (730) 384-4328 Emmanuel Holmes (747) 629-0925 Constantinople Café 364-67-KEBAB Subtraction Consulting, Ltd 544-REMOVE-19 Nicole Haas 804.849.0601 Beverly Roberts 1.725.754.8597 Melba Patel 15504776792 Calgary Health and Safety Centre (403) CORONA-1 Hubert Sampson +1–(845)–674–6180 Supreme Seattle Flower Shop (425)-TULIPS-2 Verna Mayo 1 (815) 865-1650 Sherman Keller (678) 531-6758 Sharlene Dudley (829) 856-7001 Kate Guerra 540_6288287 Salvador Walters +1 830▸625▸3435 Kellie Freeman 1 (610) 464•578 Magdalena Glover +1(319)569-6421 Rachel Wang 530-848-0535 Boris Hoffman 868—686—9739 Vernon Philips 8794103965 Renee Frank 194033846507 Anthony McGrath (916) 629-6619 Brandon Monroe 1(854)591-5120 Zippers 123 321-ZIPPERS Evangelina Strickland 1 (900) 675·1742 Vicente Bender 9375778873 Mattie Steele 1 (859) 878-6667 Antwan Blackwell (712) 866-8076 Chester York 918.7667576 Earl Vega 1–351–567–9758 Karin Gaines (514)▪265▪3029 Paul Holden 1 (475) 914-5650 Wallace Hughes 234-5853040 Christie Mitchell (934)-630-4558 Arnoldo Mclean 1-817-246-1456 Carroll Cuevas (934) 807 1799 Minnie Bradley (206)592.0746 Eva Lehman +1(249)971·9773 Gulf Coast Bridge Consultants 228-66-PYLON Ralph's Hardware Emporium (409) WINGNUT Charlene Houston 16047090550 Vicki Carey (500) 694_5031 Nicholas Singleton (679) 741-6462 Joseph Santos 8284942683 Stanford Terry +1(740)239-0940 Nichole Gibson (340) 981-3730 Elwood Newton (758) 621▪6349 Rory Rosario 1 (826) 785.2808 Dallas Museum of Space Exploration 21469ORBIT 24/7 Politics Podcast 535-OUTRAGE Angelita Serrano 1-937-54-2057 Young Howe (325)562_7065 Riverside Consignment 951-CONSIGN Joan Goodwin (548) 729-0155 Dave Bruce 709-539-8226 Sara Bernard (769) 207_7001 One Stop Magic Shop +1(434) 93-MAGIC Jacob Newton (468)968▸1860 Island Diet Centre 345-71-CARBS Swiss Culture Club 368.YODEL.44 Riley Harmon 253•325•3570 Cora Sawyer 912-410-4767 Marissa Sherman (847) 591–9982 Franklin Winter 646-527-7435 Kathie Martinez 585-886-3046 Claudia Blackburn (661) 375·2002 Jessie Mcgee 347·484·0577 Lemuel Carey 607801315 Gretchen Wu 5346955207 Louie Ho 1(526)880.0787 Brooke Massey 641•354•0826 Colleen McConnell 14739935288 Lonny Sandoval (925)984.2943 Joan Wong 1 (217) 239 6408 Celeste Wagner 682_479_1997 Maxine Reeves 1—847—200—7682 Janie Conley +1 (805) 820 2667 Nina Manning 518-936-5410 Cheerleading Warehouse 656 POMPOMS Bennett Freeman (786)623.4656 Suffolk County Demolition Experts 631-BACKHOE Kristie Tran 323-800-1567 Ye Olde Vintage Clothing Shoppe (528)-CRAVATS Jeannie Lester 1—360—770—7631 Kerry Mckee +1—(570)—729—6561 Camille Burton (220).691.7942 Marilyn Greene (450)800-8228 Mckinley Mckenzie (615) 323-7248 Portland Medieval Armor Shop 971-53-JOUST Kathy Bentley (538)297.0029 Truman Castaneda 1(281)956_9002 Chelsea Zamora (564) 599-1933 Garry Hoover 231•472•8212 Data Science, Inc (970)8 PANDAS Amber Stout (938) 244–0140 Leonard Barnes 1 (708) 438 0412 Elmer Irwin 1 (781) 338—8712 April Moss (864) 605-7368 Fletcher Espinoza (251)696-5236 Stefanie Browning 1 606 878 1983b Thurman Garza (825) 989▸4374 Paula Jones 1 (346) 388-2412 Amanda Franklin 518 562_9478 Cristopher Garrett 866 389-7213 Krystal Watson (826) 660.2221 Candice Leonard (807)782-2826 Morgan Anderson 1 (260) 696▸9101 Leo Wells 1-(947)-356-1568 Terrell Watts 4059925155 Josefina Crow 1-527-281-9621 Anna Groves +1—(649)—362—6399 Sergio Brewer 913.634.1346"

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html