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

/
/
g

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"\/\*[\s\S]*?\*\/" test_str = ("@charset \"utf-8\";\n" "* { margin: 0; padding: 0; }\n" "html { padding:0px; margin:0px; overflow-y: scroll;}\n" "body { \n" " background-color:#fff; \n" " margin:0; padding:0; \n" " text-align:center; \n" " font:normal 13px Arial, Helvetica, sans-serif; \n" " color:#575757; \n" "}\n" "img {border:0;}\n" "/* main */\n" ".main {\n" " width:100%;\n" " padding:0; margin:0 auto;\n" "}\n" ".text_pane {}\n" ".text_pane ul {margin:0; margin-top:5px; margin-bottom:5px; padding:0; padding-left:15px;}\n" ".text_pane img {margin-bottom:15px;}\n" ".center_pane .text_pane {\n" " font-size:100%; \n" " text-align: left;\n" " margin:0; padding:0; \n" " padding-left:20px;\n" " padding-right:20px;\n" " line-height:20px;\n" "}\n\n" ".text_pane {\n" " padding-left:30px;\n" " padding-right:30px;\n" "}\n" ".center_pane .text_pane p { \n" " margin:0; padding:0;\n" " margin-top:5px;\n" " margin-bottom:5px;\n" " text-align: justify;\n" " line-height:20px;\n" "}\n" "/* RIGHT pane */\n" ".wright { \n" " width:400px; float:left; \n" " border:1px solid #bbb; background-color:#fff; \n" " margin-top: 20px; margin-left:20px; margin-bottom:10px; padding:20px; \n" "}\n" ".wright p {margin:0px; padding:0;}\n" "/* RIGHT PANE */ \n" ".right_pane { float: right; \n" " width:260px;\n" " margin-top:5px;\n" " padding-left: 20px;\n" " padding-bottom: 20px;\n" " padding-right:20px;\n" "}\n" ".right_pane ul li {list-style:none;}\n" ".buttons_reg_eval {width:200px; margin-top:25px; margin-right:8px; cursor:pointer;}\n" "/* BREAD CRUMBS*/\n" "#crumbs, #crumbs a {\n" " float:left;\n" " text-align:left;\n" " margin: 0; padding: 0; padding-left: 18px;\n" " width:auto;\n" " height:35px;\n" " font:normal 12px/32px Arial, Helvetica, sans-serif; text-decoration:none;\n" " color:#565656;\n" "}\n" "#crumbs span { display:block; float:left; margin-top:3px;}\n" "#crumbs a {padding: 3px; }\n" "#crumbs a:hover {color:#BC470C; text-decoration:underline;}\n" ".crumb{\n" " float: left;\n" "}\n" "#crumbs {\n" " margin: 0 30px 0 20px;\n" " overflow: hidden;\n" " padding: 0px;\n" "}\n" ".crumbs-container{\n" " width: 150%;\n" "}\n" ".crumbs-arrow-next{\n" " background: url(/images/main/next.png) repeat scroll 0 0 transparent;\n" " cursor: pointer;\n" " margin-bottom: -12px;\n" " position: relative;\n" " top: 13px;\n" " width: 12px;\n" " height: 12px;\n" " display: none;\n" "}\n\n" ".crumbs-arrow-prev{\n" " margin-bottom: -12px;\n" " position: relative;\n" " right: -15px;\n" " display: none;\n" " cursor: pointer;\n" " -moz-transform: scaleX(-1);\n" " -o-transform: scaleX(-1);\n" " -webkit-transform: scaleX(-1);\n" " transform: scaleX(-1);\n" " filter: FlipH;\n" " -ms-filter: \"FlipH\";\n" " background: url(/images/main/next.png) repeat scroll 0 0 transparent;\n" " position: relative;\n" " top: 13px;\n" " width: 12px;\n" " height: 12px;\n" " display: inline;\n" "}\n" ".dots-next {\n" " background: none repeat scroll 0 0 #FFFFFF;\n" " float: left;\n" " margin-left: -30px;\n" " padding: 0 2px;\n" " position: relative;\n" " top: 10px;\n" " display: none;\n" "}\n\n" ".dots-prev {\n" " display: none;\n" " float: left;\n" " left: 28px;\n" " position: relative;\n" " top: 11px;\n" " padding: 0 2px;\n" " background: none repeat scroll 0 0 #FFFFFF;\n" "}\n" "/* Print Link */\n" "#content {position:relative;}\n" "#print_link { margin: 0; padding: 0; width:20px; height:26px; }\n" "#print_link a {display:block; position:absolute; top:13px; right:0; text-align:right; \n" " margin: 0; padding: 0; margin-right:10px;\n" " width: 16px;\n" " height: 16px;\n" " background-position: -258px 0;\n" " background-image: url(../images/sprites/sprite.png);\n" " font:normal 12px/12px Arial, Helvetica, sans-serif; line-height:32px; text-decoration:none;\n" " color:#565656; text-shadow:1px 1px #fff;\n" "}\n\n" "/* LEFT pane */\n" ".wleft {\n" " width:400px; height:300px; \n" " float:left; \n" " line-height: 22px; text-align: justify; \n" " margin-left: 70px;}\n\n" ".calendar {background:url(../images/main/calendar_bg.gif) no-repeat top left; }\n" ".calendar .data {float:left; font-weight:bold; margin-left:8px; line-height:26px; }\n" ".calendar .event {float:right; margin-right:8px; line-height:26px; margin-bottom:10px; }\n" ".calendar p {text-align:left; text-align: justify; margin-bottom:20px; clear:both;}\n\n" "ul.banner li {list-style: none outside none; padding-bottom: 10px;}\n" "ul.banner li img {width: 200px; border:1px solid #ddd;}\n\n" "/* LEFT/RIGHT MENU */\n" ".left_menu, .right_menu {\n" " font-size:12px; margin:0; padding:0; }\n" ".left_menu ul, .right_menu ul {\n" " margin: 0; \n" " padding: 0;\n" " width: 100%;\n" " list-style: none;\n" " text-align:left;\n" " background-color:#fff; \n" " margin-bottom:10px;\n" "}\n" ".left_menu ul li, .right_menu ul li {\n" " margin-top:0px; \n" " padding-left:10px;\n" " padding-right:4px; \n" " border-bottom: 1px solid #E7E7E7;\n" " line-height: 25px;\n" " display:block;\n" "}\n" ".left_menu ul li.top, .right_menu ul li.top {\n" " background-color: #F3F3F3;\n" " border-bottom: 1px solid #CCCCCC;\n" " font-size: 12px;\n" " font-weight: bold;\n" " text-align: center;\n" " text-transform: uppercase;\n\n" "}\n" ".left_menu ul li.subtitle, .right_menu ul li.subtitle {\n" " margin: 0; \n" "}\n" ".left_menu ul li a, .right_menu ul li a { \n" " display:block;\n" " text-decoration:none;\n" " outline: none;\n" " padding-top:5px; padding-bottom:5px;\n" " padding-right:15px;\n" " color: #7D7D7D;\n" " line-height: 15px;\n\n" "}\n" ".right_menu ul li.subtitle a {color:#383838;}\n" ".left_menu ul li.subtitle a:hover, .right_menu ul li.subtitle a:hover {\n" "}\n" ".left_menu ul li a:hover, .right_menu ul li a:hover{\n" " text-decoration:none;\n" "}\n" ".left_menu ul li.subtitle a, .right_menu ul li.subtitle a {\n" " color: #005784;\n" " font-size: 12px;\n" " font-weight: bold; \n" " outline: medium none;\n" " text-shadow: 1px 1px 1px #FFFFFF;\n" "}\n" ".right_menu ul li a.title_link {background:none; padding-right:5px;}\n" ".right_menu ul li a .date {color:#000;}\n" ".right_menu ul li a .title {font-size:100%;}\n" ".right_menu ul li a .type {display:block; color:#086999; font-size:100%; /*border-bottom: 1px solid #ddd;*/ padding-bottom:3px; margin-right:5px;}\n\n\n" ".left_menu ul li:hover { background-color: #EDF8FF; }\n" ".right_menu ul li:hover {background-color: #EDF8FF; }\n" ".left_menu ul li.subtitle:hover {background-color: #EDF8FF; }\n" ".right_menu ul li.subtitle:hover {background-color: #EDF8FF; }\n" ".left_menu ul li a:hover, .right_menu ul li a:hover {color:#000;}\n\n" ".right_menu ul li.subtitle {background-image:none;}\n" ".right_menu ul li.subtitle a {background-image:none; }\n\n" ".right_menu ul li.top { }\n\n" "/* for support portal*/\n" "span.support_menu_top {display:block; width:100%; height:100%;}\n\n" "/*************footer**********/\n\n" "#footer_center { \n" " width:auto;\n" " height:32px;\n" " background-color:#fff;\n" " margin:0 auto; padding:0;\n" " margin-top:20px;\n" " margin-left:15px;\n" " margin-right:15px;\n" " border-top:1px solid #eee;\n" "}\n" "#footer {\n" " height:32px; \n" " font:bold 12px Arial, Helvetica, sans-serif; line-height:28px;\n" "}\n" "#footer_bg {\n" " float:right; \n" " color:#005784;\n" " min-width:100px; height:32px; \n" " text-align:right; \n" "}\n" "#footer_bg a {color:#005784; padding:7px; text-decoration:none;}\n" "#footer_bg a:hover, #feedback a:hover {color:#B54800; text-decoration:underline;}\n" "#copyright {float:left; color:#aaa; font:normal 12px Arial, Helvetica, sans-serif; line-height:28px; margin-left:5px; }\n" ".flags {float:right; margin:0; padding:0; margin-top:4px; margin-right:3px;}\n\n" "/* FORMS */\n" "input.submit {\n" " background-image: url(\"../images/forms/button.gif\"); background-color: transparent;\n" " border: medium none;\n" " width: 160px; height: 34px; float: right; cursor: pointer;\n" " color: #702D00; text-shadow: 1px 1px #F7C175;\n" " font-size: 15px; line-height: 34px; text-align: center;\n" " margin-left: 3px; padding-bottom: 4px;\n" " cursor:pointer;\n" "}\n\n\n" "p.clr, .clr, fieldset.change_password div.clear { clear:both; height:0px; padding:0; margin:0; background:none;}\n\n" "/*TABLES */\n" "/* configurations */\n" "table { width:100%; border-collapse:collapse; margin: 0 auto; margin-bottom:10px; }\n" "th, td { border:1px solid #E9E9E9; text-align:left; padding-top: 2px; padding-bottom: 2px; padding-left: 5px; padding-right: 5px; vertical-align:middle; }\n" "td { border:1px solid #E9E9E9; }\n" "thead th { background:#E9E9E9; text-align:center; font-weight:bold; color:#565656;}\n" "td.category {background-color:#F2F2F2; font-weight:bold;}\n\n" "/*support*/\n" "table.cases {margin-top:10px; }\n" "table.cases tr:nth-child(odd) {background-color:#F3F3F3;}\n" "table.cases tr:hover {background-color:#FFF9E1;}\n" "th, th a, th.caseid, th.product, th.status, th.date, th.resolution, th.view {\n" " text-align:center; \n" " color:#2C3547; font-weight:bold; \n" " vertical-align:middle;\n" "}\n" "table.cases th a {display:block; width:100%; line-height:20px;}\n\n" "/* PRODUCTS */\n" ".product, .simple_product, .solution_category {\n" " margin-top: 20px;\n" " margin-right:1px;\n" " padding-right:30px;\n" "}\n" ".product p {min-height:135px;}\n" ".text_pane img.product_top_img {margin: 6px 0 0;}\n\n" "#products_categ_0 {float: left;\n" " margin-right: 1px;\n" " padding-right: 30px;\n" " width: 420px;}\n" ".simple_product img, #products_categ_0 img, #products_categ_1 img {float:left;}\n" ".product {\n" " float:left; \n" " width:420px;\n" " min-height:100px; \n" "}\n" ".product h2, .simple_product h2, .product h2 a, .simple_product h2 a, .solution_category h2{\n" " display:block; \n" " font:normal 22px/20px Arial, Helvetica, sans-serif; font-weight:bold;\n" " color:#565656; \n" " text-align:left; text-transform: none; text-decoration:none; \n" " margin:0px; margin-bottom:5px;\n" " text-shadow: 1px 1px 1px #ccc;\n" " clear:none;\n" "}\n" ".solution_category h2 a{color:#565656;text-decoration: none;}\n" ".product img, .simple_product img {border:0; margin-right:10px; margin-bottom:5px;}\n" ".product a, .simple_product a, .solution_category a { display: inline;}\n\n" ".product a.list_features, \n" ".simple_product a.list_features,\n" ".product a.list_solutions, \n" ".simple_product a.list_solutions {\n" " display: block; float:left;\n" " width:45%;\n" " color: #BC470C; background: url('../images/submenu/arrowsb.gif') no-repeat scroll 130px 11px #F6F6F6; \n" " border: 1px solid #ECEBEB;\n" " border-bottom: 2px solid #787878;\n" " margin:0; padding: 5px; padding-left: 10px;\n" " text-decoration:none; text-shadow: 1px 1px 1px #ddd; position:relative; outline: none;\n" " margin-right:2px; margin-bottom:2px; \n" "}\n" ".product_brochure_image {margin-right: 10px; margin-bottom:20px;}\n" "td.prod_categ_full_name {clear: left;\n" " color: #565656; background-color: #F2F2F2;\n" " font: bold 12px/24px Arial,Helvetica,sans-serif; text-shadow: 1px 1px 1px #FFFFFF; text-transform: uppercase;\n" " margin: 0;\n" " padding: 0 0 0 10px;\n" " text-align: left;\n" " vertical-align: middle;}\n" "td.prod_categ_icon {width: 40px; border-right: medium none; text-align:center;}\n" "td.prod_categ_prod_name {width: 95px; text-align: center; vertical-align: middle; border-left: medium none; text-align:left;}\n" "td.prod_categ_links {width: 110px; padding:5px;}\n" "td.prod_categ_icon a {float:left; padding-left:10px;}\n" "td.prod_categ_icon a img {padding: 0; margin: 0;}\n" "a.product_name_link {font-size: 15px; font-weight: bold; color:#565656; text-decoration:none;}\n\n" "/* SOLUTIONS */\n" ".solution_category div.product_list {\n" " display: block; float:left;\n" " width:45%;\n" " color: #BC470C; background-color: #fdfdfd; \n" " border: 1px solid #ECEBEB;\n" " border-bottom: 2px solid #787878;\n" " margin:0; padding: 5px; padding-left: 10px;\n" " text-decoration:none; text-shadow: 1px 1px 1px #ddd;\n" " margin-right:2px; margin-bottom:2px;\n" "}\n" ".solution_category div.product_list {width:100%;}\n" ".product a.list_solutions:hover, \n" ".simple_product a.list_solutions:hover, \n" ".solution_category a.list:hover,\n" ".product a.list_features:hover, \n" ".simple_product a.list_features:hover\n" "{\n" " color:#00A1E5; text-decoration:underline; background-image: url('../images/submenu/arrowsb_hover.gif');\n" "}\n\n" "div.solution_category div.text {width:60%; float:left; padding-right:20px;}\n" "div.solution_category div.links {width:30%; float:left;}\n" "div.solution_category div.links a {display:block; line-height:21px;}\n\n" ".simple_product {width:95%; }\n" ".solution_category {width:95%;}\n\n" "img {margin:0; padding:0; margin-top:0px;}\n" "img.main_solution_image {margin-top:6px;}\n" "h1.solution_title {margin-bottom:0;}\n" "h1.solution_title a {clear: left;\n" " color: #016B94;\n" " font: bold 20px/30px Arial,Helvetica,sans-serif;\n" " margin: 0 0 20px;\n" " padding: 0 0;\n" " text-align: left;\n" " text-shadow: 1px 1px 1px #DDDDDD;\n" " vertical-align: middle; text-decoration:none;}\n" "#products_info_edu {width:100%; height:100%; margin:0; padding:0; padding-top:4px;}\n" "#products_info_edu .left {width: 30px; height:25px; float:left;}\n" "#products_info_edu .right{ width: 140px; margin:0; padding:0;}\n" "#products_info_edu .right_sol_all{ float:left; width:110px;}\n" "#products_info_edu .left img { width:24px; height:24px;}\n" "#products_info_edu a {font-weight:bold; border:none; margin:0; padding:0;}\n" "#products_info_edu p { font-size:11px; line-height:14px; margin:0; padding:0; }\n" "#products_info {width:100%; height:100%; margin:0; padding:0; padding-top:7px;}\n" "#products_info .left {width: 30px; height:40px; float:left;}\n" "#products_info .right{ float:left; width: 140px; margin:0; padding:0;}\n" "#products_info .right_sol_all{ float:left; width:110px;}\n" "#products_info .left img { width:24px; height:24px;}\n" "#products_info a {font-weight:bold; border:none; margin:0; padding:0;}\n" "#products_info p { font-size:11px; line-height:14px; margin:0; padding:0; }\n" "img.solution_small_image {float:left; padding-right:10px; margin-top:10px;}\n" "div.solution_description {float:left; width:330px; margin-top:5px; text-align: justify;}\n" "div.solution_description span {text-align: justify;}\n" "div.clear {clear:both;}\n" "a.solutions_more {color: #016B94; text-decoration:none;}\n" "a.more {color: #016B94; text-decoration:underline;}\n\n" "/*.text_pane */\n" "div.text_pane p, div.text_pane ul { line-height:20px; text-align:left;}\n" "h1 {\n" " font:bold 24px Arial, Helvetica, sans-serif; line-height:30px; \n" " color:#016B94; \n" " text-align:left; vertical-align:middle; \n" " margin:0; padding:0; margin-bottom:20px; \n" " padding-top:0px; padding-bottom:0px;\n" " text-shadow: 1px 1px 1px #ddd; \n" " clear:left;\n" "}\n" "h1.below_buttons {margin-top:15px; }\n" "/*.text_pane */\n" "h2 {\n" " font:bold 18px/28px Arial, Helvetica, sans-serif; line-height:22px;\n" " color:#565656; \n" " text-align:left; vertical-align:middle; \n" " text-transform: none; \n" " margin:0; padding:0; margin-top: 25px; margin-bottom:10px; \n" " text-shadow: 1px 1px 1px #eee; \n" " clear:left; \n" "}\n" "h3 {\n" " color:#565656; \n" " font:bold 16px/28px Arial, Helvetica, sans-serif; line-height:22px;\n" " text-shadow: 1px 1px 1px #eee;\n" " margin:0; padding:0; margin-top: 20px; margin-bottom:10px;\n" " clear:left;\n" "}\n" "h4 {\n" " color:#565656; \n" " font:bold 14px/28px Arial, Helvetica, sans-serif; line-height:22px;\n" " text-shadow: 1px 1px 1px #eee;\n" " margin:0; padding:0; margin-top: 10px; margin-bottom:5px;\n" " clear:left;}\n\n" "a {color:#016B94;}\n" "a:hover {color:#7D0001;}\n" "a.link{\n" " color: #BC470C; \n" " margin:0; padding: 5px; padding-left: 0px; \n" " text-decoration:underline; text-shadow: 1px 1px 2px #ddd;\n" " margin-right:2px; margin-bottom:2px; \n" " font-size:12px;\n" " padding-bottom:10px;\n" "}\n" "a.link:hover { color:#BC470C; }\n" ".crumbs, .crumbs_arrow {width: 6px; height: 7px; background-image: url(../images/sprites/sprite.png); background-position: -16px 0; background-repeat: no-repeat; margin:0; padding:0; margin-top:12px; margin-left:3px; margin-right:3px;}\n" ".crumbs_arrow {float:left; margin-top:15px;}\n" ".solution_ajax, .features_ajax { \n" " width: 206px; position: absolute; top:32px; left:-1px;\n" " z-index:98;\n" " margin:0; padding:0;}\n\n" "/* configurations */\n" "#configurations_table {margin-top:10px;}\n" "#configurations_table th, #configurations_table td {padding:3px; padding-left:10px; line-height:18px;}\n" "#configurations_table th, #configurations_table td.category {line-height:18px; padding-top:5px; padding-bottom:5px;}\n" "td.mf_description {width:70%; line-height:28px; }\n" "td.mf_edition_option {font-size:12px; text-align:center;}\n" "td.mf_edition_option img {margin:0; padding:0;}\n" "a.hide_edition {font-size:10px; cursor:pointer; line-height:14px; color:#565656;}\n\n" ".mf_description_invisible { display:none; }\n" ".mf_description_visible { display:block; line-height: 20px; font-size:13px; color:#737373;}\n\n" "/* University Program Overview*/\n" "#university_table {margin-top:20px;}\n" "#university_table th, #university_table td {padding:3px; padding-left:10px; line-height:18px;text-align:center;}\n" "#university_table th, #university_table td.category {line-height:18px; padding-top:5px; padding-bottom:5px;}\n" "#university_table td.centered {text-align:center;} \n" "#university_table td.leftcentered {text-align:left;} \n" "#university_table a.main_small_button, #university_table a.main_small_highlighted_button, #university_table a.wide_button {margin:0 auto;}\n" "#university_table img {margin:0; padding:0; padding-right:5px;}\n\n" "/* top marketing features list */\n" "ul.mf_list, div.mf_descriptions { margin:0; padding:0; margin-top:10px; }\n" "ul.mf_list { margin-right:-2px;}\n" "ul.mf_list {width:200px; float:left; list-style: none; line-height:18px; }\n" "ul.mf_list li { padding:5px; background-color:#f2f2f2; border-top:1px solid #f2f2f2; border-bottom:1px solid #E2E2E2; }\n" "ul.mf_list li.active { border:none; background-color:#fff; border-top:1px solid #ddd; border-bottom:1px solid #ccc;}\n" "ul.mf_list li a { display:block; font-size:13px; text-decoration:none;}\n" "ul.mf_list li a:hover { text-decoration:underline;}\n" "ul.mf_list li.active a {color:#BC470C;} \n" "ul.mf_list li.active a:hover {text-decoration:none; }\n" "div.mf_descriptions {width:424px; float:left; background-color:#fff; padding:0px; padding-left:15px; }\n" ".feature_description {display:none; }\n" ".feature_description_visible {height:100%; display:block; padding:5px; }\n\n" "/* static page - IP Products */\n" "table.styledTable { border-collapse: collapse;}\n" "table.styledTable td, table.styledTable th { padding: 2px; padding-left:10px; border: solid 1px #ccc;}\n" "table.styledTable td{ padding: 3px;}\n" "table.styledTable th{ background: #989797; padding-top: 3px; padding-bottom: 3px; color:#2C2C2C;}\n" "table.styledTable tr.section{ background: #DADADA; font-weight: normal; color: #2C2C2C;}\n" "tr.section div.panelCollapsible{ height: 1.3em; cursor: pointer;}\n" "div.panelCollapsible div.collapsibleHeader{ float: left;}\n" "div.panelCollapsible div.imgCollapse, div.panelCollapsible div.imgExpand{ width: 13px; height: 13px; float: right; margin-top: 2px; margin-right: 2px;}\n" "table.styledTable .altRow, table.styledTable .spotRow { background: #FFFFFF;}\n\n" "#admin_header {height:80px;}\n" ".partners img {padding:10px;}\n\n" "#links_icons {width:60px; height:20px; position:absolute; top:10px; right:25px;}\n\n" "/* Eval License Request page*/\n" "#help {width:100%;}\n" "#help h2 {margin:0; padding:0; margin-top:5px; }\n" "#help h4 {color:#000; margin:0; padding:0; margin-top:5px; }\n" "#help h3 {margin:0; padding:0; margin-top:5px; color:#0087CA; font-size:12px;}\n" "#help p, #help div, #help ol, #help ol li {font-size:11px; line-height:15px;}\n" "#help p { margin:0; padding:0;}\n" "hr {margin:0; padding:0;}\n\n" "/* Configurations */\n" "#mfoption_description {text-align:left; margin:0; padding:0; padding-left: 10px;}\n\n" "/* Downloads */\n\n" "#downloads_versions { padding-top:30px; }\n" "#downloads_versions img.legend_img {}\n" "#downloads_versions span.downloads_legend { width:300px; line-height:30px; }\n" "tr.tr_category td {cursor:pointer; width:100%; }\n" ".library_show { display:table-row;}\n" ".library_hide {display:none;}\n" ".downloads_box p.file_description {display:block; padding-left:30px; padding-right:30px; text-transform:none; font-weight:normal;}\n\n" "/* solutions */\n" "div.solutions_pane table, div.solutions_pane table tr, div.solutions_pane table tr td {border:1; border-color:#ffffff; padding:0; margin:0; vertical-align:top;}\n" "div.solutions_pane table tr td {padding:10px;}\n" "div.solutions_pane hr {height:3px; border:0px; background: url(\"/images/main/hr.gif\") repeat-x scroll 0 0 #3E98C5;}\n\n" "/* solutions vendor flow */\n" "div.solutions_pane table.solutions_flow, div.solutions_pane table.solutions_flow tr, div.solutions_pane table.solutions_flow tr td {border:1; border-color:#e9e9e9; padding:0; margin:0; vertical-align:middle;}\n" "div.solutions_pane table.solutions_flow tr td {padding:4px;}\n\n" "/*webinars*/\n" ".webinar_description {padding:5px 10px;}\n\n" "/*Share buttons*/\n" ".share_button {margin: 2px; padding: 2px; float: left;}\n" ".share_button a{text-decoration: none; color: #444; border: 0; display: block; width: 61px; height: 20px; background-image: url(../images/sprites/sprite.png); background-repeat: no-repeat;}\n" "#share {float: right; width: auto; padding: 0 3px;}\n" "#share a ,#share a:hover,#share a:visited{color: #226; text-decoration: none;}\n" "#share_buttons {display: none; z-index: 50; position: absolute; right: 0px; top: 20px; background: #EFEFEF; border: solid 1px #DDD; border-radius: 5px; -moz-border-radius: 5px; box-shadow: 2px 2px 3px #888; opacity: 1; height: auto; width: 140px; padding: 7px;}\n" ".share-digg {\n" " background-position: -83px 0; \n" "}\n" ".share-linkedin {\n" " background-position: -79px -37px; \n" "}\n" ".share-twitter {\n" " background-position: -61px -178px; \n" "}\n" ".share-facebook {\n" " background-position: -205px -17px; \n" "}\n" ".share-google-plus {\n" " background-position: 0 -37px; \n" "}\n" ".share-slashdot {\n" " background-position: 0 -178px; \n" "}\n" ".share-delicious {\n" " background-position: -22px 0; \n" "}\n" ".share-email {\n" " background-position: -144px 0; \n" "}\n" ".share-share {\n" " width: 50px; \n" " height: 18px;\n" " display: block;\n" " background-position: -162px -37px; \n" " background-repeat: no-repeat;\n" " background-image: url(../images/sprites/sprite.png); background-repeat: no-repeat;\n\n" "}\n" "a.more_link { font-size:12px; color:#9B9B9B; background: url(\"/images/main/arrow.png\") no-repeat scroll 28px 0px transparent; text-decoration:none; border-bottom:1px solid #ccc;}\n" ".link_on_dark a {color: #fff;}\n" "a.pdf {background: url(/images/main/pdf_icon.png) center right no-repeat; padding-right: 18px;}\n\n" "/* Product Pages - right menu*/\n" "#right_menu {float: left; margin: 30px 0 0 18px; width: 162px;}\n" "#right_menu ul {margin:0; padding:0; border:1px solid #ddd;}\n" "#right_menu ul li {list-style: none outside none; margin:0; padding:0 12px 0 10px; }\n" "#right_menu ul li.noborder a{ border:none;}\n" "#right_menu ul li a { display:block;color: #565656; font: 13px/16px Arial,Helvetica,sans-serif; text-decoration:none; padding-top:8px; padding-bottom:8px; padding-right:5px; padding-left:30px; border-bottom: 1px solid #ddd;}\n" "#right_menu ul li a.hightlighted {color: #005784; font: bold 13px/22px Arial,Helvetica,sans-serif;}\n" "#right_menu ul li a.downloads {background: url(\"/images/content/icons/icon_download.gif\") no-repeat scroll left 4px transparent; font-weight:bold; color: #005784;}\n" "#right_menu ul li a.what {background: url(\"/images/content/icons/icon_whats_new.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.config {background: url(\"/images/content/icons/icon_config.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.datasheet {background: url(\"/images/content/icons/icon_whats_new.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.news {background: url(\"/images/content/icons/icon_news.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.training {background: url(\"/images/content/icons/icon_training.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.multimedia {background: url(\"/images/content/icons/icon_multimedia.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.documentation {background: url(\"/images/content/icons/icon_doc.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.contact {background: url(\"/images/content/icons/icon_contact.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a.faq {background: url(\"/images/content/icons/icon_faq.gif\") no-repeat scroll left 4px transparent;}\n" "#right_menu ul li a:hover { color:#000;}\n\n" "/* Custom menu used on Solution pages */\n" "#custom_menu {float:right; margin: 0 0 0 0; width: 162px;}\n" "#custom_menu ul {margin:0; padding:0; border:1px solid #ddd;}\n" "#custom_menu ul li {list-style: none outside none; margin:0; padding:0 12px 0 10px; }\n" "#custom_menu ul li.noborder a{ border:none;}\n" "#custom_menu ul li a { display:block;color: #565656; font: 13px/16px Arial,Helvetica,sans-serif; text-decoration:none; padding-top:8px; padding-bottom:8px; padding-right:5px; padding-left:30px;}\n" "#custom_menu ul li a.hightlighted {color: #005784; font: bold 13px/22px Arial,Helvetica,sans-serif;}\n" "#custom_menu ul li a.downloads {background: url(\"/images/content/icons/icon_download.gif\") no-repeat scroll left 4px top 12px transparent; font-weight:bold;}\n" "#custom_menu ul li a:hover { color:#000;}\n\n" "#products_pane {float: left; width: 535px;}\n" "#products_pane h1 {\n" " clear: left;\n" " color: #565656;\n" " font: bold 18px/22px Arial,Helvetica,sans-serif;\n" " margin: 25px 0 10px;\n" " padding: 0;\n" " text-align: left;\n" " text-shadow: 1px 1px 1px #EEEEEE;\n" " text-transform: none;\n" " vertical-align: middle;\n" "}\n\n" "ul#featuredResBlock {padding: 0;}\n" "ul#featuredResBlock li.featured { background-color: #F3F3F3;\n" " border-bottom: 1px solid #CCCCCC;\n" " font-size: 12px;\n" " font-weight: bold;\n" " text-align: center;\n" " text-transform: uppercase;\n" " line-height: 25px;}\n" "ul#featuredResBlock {border:1px solid #ddd;}\n\n" "ul#featuredResBlock img { margin-bottom: 5px; margin-top: 5px;}\n\n" ".featuredCateg {color: #005784; font-weight: bold;}\n" "li.fCategDelim span {/*border-top: 1px solid #ddd; */display: block; }\n" "#right_menu ul li.featuredCateg { padding-top:5px;}\n" "#right_menu ul li.featuredRes a {text-align: left; font-size: 13px; line-height: 18px; margin: 0; padding:0; padding-top:5px; padding-bottom:5px; }\n" "#right_menu ul li.noline a {border-bottom: none;}\n\n" "/* products overview page */\n" "td.prod_categ_links {padding-left:10px; padding-right:10px;}\n" "td.prod_categ_description {padding-left:15px; padding-right:15px;}\n" "td.prod_categ_links a.product_link { color: #7D7D7D;\n" " display: block;\n" " line-height: 15px;\n" " outline: medium none;\n" " padding-bottom: 5px;\n" " padding-left: 10px;\n" " padding-top: 5px;\n" " text-decoration: none;\n" " border-top:1px solid #ddd;\n" "}\n" "td.prod_categ_links a.product_link:hover {background-color:#EDF8FF; color:#000;}\n" "td.prod_categ_links a.read_more {border:none;} \n" "td.prod_categ_links a.eval {color: #005784;\n" " font-size: 12px;\n" " font-weight: bold;\n" " outline: medium none;\n" " text-shadow: 1px 1px 1px #FFFFFF;}\n\n" "a.arcive_builds_link { font-weight:bold; display:block; border:1px solid #eee; text-align:left; margin-right:40px; padding-left:10px; padding-top:4px; padding-bottom:4px;}\n\n" "ul.checkbox_list {margin-left:100px; }\n" "ul.checkbox_list li{ width: 116px; list-style:none; height:18px; float:left; padding:0;}\n" "fieldset.register_form div span.input_text ul.checkbox_list input {float:right; width:10px; padding:0; margin:0;}\n" "fieldset.register_form div span.input_text ul.checkbox_list label {float:left; width:88px; height:20px; line-height:20px;}\n\n" ".highlighted_text {color:#7D0001 !important; font-weight: bold;}\n\n" "/*Connect with us widget*/\n" ".connectwithus_widget {margin: 20px 0;}\n" ".connectwithus_flags {float: left;}\n" ".connectwithus_title {display: block; font-size: 14px; font-weight: bold; text-align: left;}") matches = re.finditer(regex, test_str) for matchNum, match in enumerate(matches, start=1): print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group())) for groupNum in range(0, len(match.groups())): groupNum = groupNum + 1 print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.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