Regular Expressions 101

Save & Share

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

/
/

Test String

Code Generator

Generated Code

# coding=utf8 # the above tag defines encoding for this document and is for Python 2.x compatibility import re regex = r"^\d+\n\[*\"tb\"" test_str = ("8269\n" "[[\"tb\",0,[[\"15197cf34142bc38\",\"15197cf34142bc38\",\"15197cf34142bc38\",0,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^cob_sm_offer\",\"^i\",\"^io_unim\",\"^os_promo\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eScrooge is this Christmas' hero: Save 50% on Premium Plus\\u003c/b\\u003e\",\"€ 40 For 1 Year Premium_Plus - Enjoy all Premium features on any 5 devices simultaneously - Buy Now →\",0,\"\",\"\",\"\\u003cb\\u003eDec 12\\u003c/b\\u003e\",\"Sat, Dec 12, 2015 at 8:08 PM\",1450086289306000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"15182d5f161748ea\",\"15182d5f161748ea\",\"15182d5f161748ea\",0,0,[\"^all\",\"^i\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^esa\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_notification\",\"^os_pure_notif\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^sq_ig_i_personal\",\"^u\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"noreply@mailer.atlassian.com\\\" name\\u003d\\\"Atlassian\\\"\\u003eAtlassian\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eBitbucket is upgrading to Atlassian account\\u003c/b\\u003e\",\"Your Bitbucket account is being migrated to a new Atlassian account Atlassian Dear Bitbucket Team\",0,\"\",\"\",\"\\u003cb\\u003eDec 8\\u003c/b\\u003e\",\"Tue, Dec 8, 2015 at 6:23 PM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"noreply@mailer.atlassian.com\",,,,0,0],[\"15173e2986cad4c8\",\"15173e2986cad4c8\",\"15173e2986cad4c8\",0,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^cob_sm_offer\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_promo\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eHalf-Price Premium_Plus\\u003c/b\\u003e\",\"€40 for 1 year Premium_Plus - Enjoy all Premium features on any 5 devices simultaneously - Buy now →\",0,\"\",\"\",\"\\u003cb\\u003eDec 5\\u003c/b\\u003e\",\"Sat, Dec 5, 2015 at 8:43 PM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1513ad2d72ce77b8\",\"1513ad2d72ce77b8\",\"1513ad2d72ce77b8\",0,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_pevent\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_promo\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003e70% Discount For The Premium Subscription\\u003c/b\\u003e\",\"€ 15 intead of € 50 for 1 year Premium - This Black Friday offer is available until December 2, 2015\",0,\"\",\"\",\"\\u003cb\\u003eNov 24\\u003c/b\\u003e\",\"Tue, Nov 24, 2015 at 6:47 PM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1512b072bb0f5248\",\"1512b072bb0f5248\",\"1512b072bb0f5248\",0,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_promo\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eLoad pages faster with CyberGhost's data compression feature\\u003c/b\\u003e\",\"CyberGhost\\u0026#39;s new feature can extend your mobile data plan by up to five times - Find out more →\",0,\"\",\"\",\"\\u003cb\\u003eNov 21\\u003c/b\\u003e\",\"Sat, Nov 21, 2015 at 5:11 PM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1511d76736acdd44\",\"1511d76736acdd44\",\"1511d76736acdd44\",0,0,[\"^all\",\"^i\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_pevent\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_notification\",\"^os_pure_notif\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^sq_ig_i_personal\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"docker@info.docker.com\\\" name\\u003d\\\"Docker Team\\\"\\u003eDocker Team\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eFinal Reminder - Docker Hub push deprecation for clients 1.5 and earlier - Nov 19\\u003c/b\\u003e\",\"Docker Docker Hub deprecation for v1.5 clients Nov 19 Dear User, This is a final reminder about the\",0,\"\",\"\",\"\\u003cb\\u003eNov 19\\u003c/b\\u003e\",\"Thu, Nov 19, 2015 at 1:58 AM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"docker@info.docker.com\",,,,0,0],[\"1511633a2b071aa7\",\"1511633a2b071aa7\",\"1511633a2b071aa7\",0,0,[\"^all\",\"^i\",\"^p_mtunsub\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_promo\",\"^p_mtunsub\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"docker@info.docker.com\\\" name\\u003d\\\"Docker Team\\\"\\u003eDocker Team\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eWhat's new with Docker?\\u003c/b\\u003e\",\"Docker What\\u0026#39;s new with Docker? We made a lot of announcements as part of DockerCon EU so we\",0,\"\",\"\",\"\\u003cb\\u003eNov 17\\u003c/b\\u003e\",\"Tue, Nov 17, 2015 at 4:07 PM\",1449859048157000,,[],,0,[\"Docker Team\"],,[],,\"1\",[0],,\"docker@info.docker.com\",,,,0,0],[\"15111979244994a2\",\"15111979244994a2\",\"15111979244994a2\",0,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_promo\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eNo more ads with CyberGhost’s new ad blocking feature\\u003c/b\\u003e\",\"Say goodbye to annoying banners, pop-ups, and auto-playing videos CyberGhost 5.5 now has a built-in\",0,\"\",\"\",\"\\u003cb\\u003eNov 16\\u003c/b\\u003e\",\"Mon, Nov 16, 2015 at 6:38 PM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1510367296728ea9\",\"1510367296728ea9\",\"1510367296728ea9\",0,0,[\"^all\",\"^i\",\"^p_mtunsub\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^cob_pevent\",\"^cob_sm_emailmessage\",\"^cob_sm_forme\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_notification\",\"^os_pure_notif\",\"^p_mtunsub\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^sq_ig_i_personal\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"docker@info.docker.com\\\" name\\u003d\\\"Docker Team\\\"\\u003eDocker Team\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003eDocker Hub deprecation for v1.5 clients Nov 19.\\u003c/b\\u003e\",\"Docker Docker Hub deprecation for v1.5 clients Nov 19 Dear User, This is a second reminder about the\",0,\"\",\"\",\"\\u003cb\\u003eNov 14\\u003c/b\\u003e\",\"Sat, Nov 14, 2015 at 12:31 AM\",1449859048157000,,[],,0,[\"Docker Team\"],,[],,\"1\",[0],,\"docker@info.docker.com\",,,,0,0],[\"150f81a1a1c31c21\",\"150f81a1a1c31c21\",\"150f81a1a1c31c21\",0,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[\"^all\",\"^cob-processed-gmr\",\"^i\",\"^imap_kw_NonJunk\",\"^io_unim\",\"^os_promo\",\"^smartlabel_promo\",\"^sq_ig_i_promo\",\"^u\",\"^unsub\"],\"\\u003cspan class\\u003d\\\"zF\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u003cb\\u003e\\u0026raquo;\\u003c/b\\u003e\\u0026nbsp;\",\"\\u003cb\\u003e5 Newly Added Features\\u003c/b\\u003e\",\"Ad-Blocker - Malware and Virus Protection - Prevent online tracking - Force HTTPS - Data compression\",0,\"\",\"\",\"\\u003cb\\u003eNov 11\\u003c/b\\u003e\",\"Wed, Nov 11, 2015 at 7:51 PM\",1449859048157000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0]]]]\n" "5594\n" "[[\"tb\",10,[[\"150b52f1c2a8fadc\",\"150b52f1c2a8fadc\",\"150b52f1c2a8fadc\",1,0,[\"^all\",\"^i\",\"^p_mtunsub\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"docker@info.docker.com\\\" name\\u003d\\\"Docker Team\\\"\\u003eDocker Team\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Automated Build upgrades on Docker Hub\",\"Automated Build upgrades on Docker Hub Dear Docker Hub User, Next week Docker Hub is releasing a\",0,\"\",\"\",\"Oct 29\",\"Thu, Oct 29, 2015 at 7:59 PM\",1446548162372000,,[],,0,[\"Docker Team\"],,[],,\"1\",[0],,\"docker@info.docker.com\",,,,0,0],[\"150afeef36c005b5\",\"150afeef36c005b5\",\"150afeef36c005b5\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Haunting Discount\",\"Upgrade to a Premium annual subscription and save 50% off the total price! - Enjoy this offer now →\",0,\"\",\"\",\"Oct 28\",\"Wed, Oct 28, 2015 at 7:31 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1508b2a1e37ee105\",\"1508b2a1e37ee105\",\"1508b2a1e37ee105\",1,0,[\"^all\",\"^i\",\"^p_mtunsub\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"docker@info.docker.com\\\" name\\u003d\\\"Docker Team\\\"\\u003eDocker Team\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Tutum is now part of Docker!\",\"Tutum is now part of Docker! Email not displaying correctly? View it in your browser. Dear Docker\",0,\"\",\"\",\"Oct 21\",\"Wed, Oct 21, 2015 at 4:10 PM\",1446548162372000,,[],,0,[\"Docker Team\"],,[],,\"1\",[0],,\"docker@info.docker.com\",,,,0,0],[\"150871038c1347f9\",\"150871038c1347f9\",\"150871038c1347f9\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Trick or Tweet\",\"Halloween is right around the corner and so is the deadline for our awesome contest - Win a Premium+\",0,\"\",\"\",\"Oct 20\",\"Tue, Oct 20, 2015 at 9:03 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1508496304472aad\",\"1508496304472aad\",\"1508496304472aad\",1,0,[\"^all\",\"^i\",\"^iim\",\"^io_im\",\"^io_imc5\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"account-security-noreply@account.microsoft.com\\\" name\\u003d\\\"Microsoft account team\\\"\\u003eMicrosoft account team\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Microsoft account unusual sign-in activity\",\"Microsoft account Verify your account We detected something unusual about a recent sign-in for the\",0,\"\",\"\",\"Oct 20\",\"Tue, Oct 20, 2015 at 9:30 AM\",1446548162372000,,[],,0,[],,[],,\"1\",[1],,\"account-security-noreply@account.microsoft.com\",,,,0,0],[\"15072d332d6e69ff\",\"15072d332d6e69ff\",\"15072d332d6e69ff\",1,0,[\"^all\",\"^i\",\"^p_mtunsub\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"docker@info.docker.com\\\" name\\u003d\\\"Docker Team\\\"\\u003eDocker Team\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Docker Hub deprecation for clients 1.5 and earlier\",\"Docker Hub deprecation for clients 1.5 and earlier Email not displaying correctly? View it in your\",0,\"\",\"\",\"Oct 16\",\"Fri, Oct 16, 2015 at 10:44 PM\",1446548162372000,,[],,0,[\"Docker Team\"],,[],,\"1\",[0],,\"docker@info.docker.com\",,,,0,0],[\"15072071a77e7ca4\",\"15072071a77e7ca4\",\"15072071a77e7ca4\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Half-Price Premium+\",\"30 days money back guarantee. You won\\u0026#39;t believe what a difference a tune-up can make. Find out →\",0,\"\",\"\",\"Oct 16\",\"Fri, Oct 16, 2015 at 7:01 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"15071114de97a34f\",\"15071114de97a34f\",\"15071114de97a34f\",1,0,[\"^all\",\"^i\",\"^o\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"noreply@mailer.atlassian.com\\\" name\\u003d\\\"Atlassian\\\"\\u003eAtlassian\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Atlassian email confirmation\",\"Welcome to Atlassian! Hi Uknown, We\\u0026#39;ve created a new Atlassian ID for you using this email\",0,\"\",\"\",\"Oct 16\",\"Fri, Oct 16, 2015 at 2:32 PM\",1445350700343000,,[],,0,[],,[],,\"1\",[0],,\"noreply@mailer.atlassian.com\",,,,0,0],[\"150710c54f4e10d3\",\"150710c54f4e10d3\",\"150710c54f4e10d3\",1,0,[\"^all\",\"^i\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"noreply@bitbucket.org\\\" name\\u003d\\\"Bitbucket\\\"\\u003eBitbucket\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"[Bitbucket] Confirm your email address\",\"You recently entered a new email address for the user master6932. Please confirm your email by\",0,\"\",\"\",\"Oct 16\",\"Fri, Oct 16, 2015 at 2:27 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"noreply@bitbucket.org\",,,,0,0],[\"1505c8abcf31b416\",\"1505c8abcf31b416\",\"1505c8abcf31b416\",1,0,[\"^all\",\"^i\",\"^iim\",\"^io_im\",\"^io_imc5\",\"^o\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"noreply@docker.io\\\" name\\u003d\\\"Docker\\\"\\u003eDocker\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Please confirm email for your Docker Hub account\",\"To activate your account, please verify your email address Confirm Your Email You have received this\",0,\"\",\"\",\"Oct 12\",\"Mon, Oct 12, 2015 at 2:53 PM\",1444661621847000,,[],,0,[],,[],,\"1\",[1],,\"noreply@docker.io\",,,,0,0]]]]\n" "5469\n" "[[\"tb\",20,[[\"1504ec932c749bb3\",\"1504ec932c749bb3\",\"1504ec932c749bb3\",1,0,[\"^all\",\"^i\",\"^iim\",\"^io_im\",\"^io_imc5\",\"^o\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"do-not-reply-support@lastpass.com\\\" name\\u003d\\\"LastPass\\\"\\u003eLastPass\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"LastPass Joins LogMeIn\",\"LastPass Joins the LogMeIn Family It\\u0026#39;s a big day here at LastPass. We\\u0026#39;re thrilled to announce\",0,\"\",\"\",\"Oct 9\",\"Fri, Oct 9, 2015 at 10:47 PM\",1444659286396000,,[],,0,[],,[],,\"1\",[1],,\"do-not-reply-support@lastpass.com\",,,,0,0],[\"15048e54b7f48efb\",\"15048e54b7f48efb\",\"15048e54b7f48efb\",1,0,[\"^all\",\"^i\",\"^o\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Special Offer\",\"30% discount for a Premium Plus annual subscription. Enjoy warp speed on up to 5 devices. Read more →\",0,\"\",\"\",\"Oct 8\",\"Thu, Oct 8, 2015 at 7:19 PM\",1444659281563000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"1502e0dca762a5d5\",\"1502e0dca762a5d5\",\"1502e0dca762a5d5\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Win A Premium Plus Subscription\",\"Hey Ghostie, Enter our challenge now and you can win 1 of 10 one-year CyberGhost Premium Plus\",0,\"\",\"\",\"Oct 3\",\"Sat, Oct 3, 2015 at 2:14 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"15009b9c7a4986be\",\"15009b9c7a4986be\",\"15009b9c7a4986be\",1,0,[\"^all\",\"^i\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Exclusive iOS App Feature Preview\",\"Hey Ghostie, As you already know, we\\u0026#39;re really close to rolling out our new iOS App! We\\u0026#39;d\",0,\"\",\"\",\"Sep 26\",\"Sat, Sep 26, 2015 at 12:56 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"14ffb02babfab555\",\"14ffb02babfab555\",\"14ffb02babfab555\",1,0,[\"^all\",\"^i\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Prevent Identity Theft - 5 Easy Tips\",\"♥ Keep calm and stay safe online I know that even as you\\u0026#39;re reading this, you\\u0026#39;re still trying\",0,\"\",\"\",\"Sep 23\",\"Wed, Sep 23, 2015 at 4:21 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"14feb2bc84882425\",\"14feb2bc84882425\",\"14feb2bc84882425\",1,0,[\"^all\",\"^i\",\"^smartlabel_notification\",\"^smartlabel_pure_notif\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Save over 30%\",\"By upgrading to an annual Premium Plus subscription basically, you get more bang for your buck. Hi\",0,\"\",\"\",\"Sep 20\",\"Sun, Sep 20, 2015 at 2:32 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"14fe5481068968a4\",\"14fe5481068968a4\",\"14fe5481068968a4\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"New iOS App\",\"We have some very exciting news for you today: our iOS App is almost ready to hit the App Store and\",0,\"\",\"\",\"Sep 19\",\"Sat, Sep 19, 2015 at 11:05 AM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"14fc1e147e626d99\",\"14fc1e147e626d99\",\"14fc1e147e626d99\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"Track me if you can\",\"Avoid Being Tracked Online: 3 Super-Easy Things You Can Start Doing Today You\\u0026#39;re being tracked\",0,\"\",\"\",\"Sep 12\",\"Sat, Sep 12, 2015 at 2:06 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"14f7a84be5de50ab\",\"14f7a84be5de50ab\",\"14f7a84be5de50ab\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"2-year Premium_Plus subscription at half-price\",\"We recently launched a more accessible Premium_Plus subscription, which comes with a 1 year bonus\",0,\"\",\"\",\"Aug 29\",\"Sat, Aug 29, 2015 at 5:32 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0],[\"14f46f3b4d1d07a1\",\"14f46f3b4d1d07a1\",\"14f46f3b4d1d07a1\",1,0,[\"^all\",\"^i\",\"^smartlabel_promo\",\"^unsub\"],[],\"\\u003cspan class\\u003d\\\"yP\\\" email\\u003d\\\"newsletter@cyberghost.info\\\" name\\u003d\\\"CyberGhost VPN\\\"\\u003eCyberGhost VPN\\u003c/span\\u003e\",\"\\u0026raquo;\\u0026nbsp;\",\"(-50%) For 1 Year Premium Plus\",\"Time for an upgrade? You won\\u0026#39;t believe what a difference a tune-up can make! Upgrade to a\",0,\"\",\"\",\"Aug 19\",\"Wed, Aug 19, 2015 at 5:13 PM\",1446548162372000,,[],,0,[],,[],,\"1\",[0],,\"newsletter@cyberghost.info\",,,,0,0]]]]\n") matches = re.search(regex, test_str) if matches: print ("Match was found at {start}-{end}: {match}".format(start = matches.start(), end = matches.end(), match = matches.group())) for groupNum in range(0, len(matches.groups())): groupNum = groupNum + 1 print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = matches.start(groupNum), end = matches.end(groupNum), group = matches.group(groupNum))) # Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.

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 Python, please visit: https://docs.python.org/3/library/re.html