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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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"
"
gmi

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"^(?P<protocol>[\w]+)\:\/\/(?P<host>[\w\.\-]+)(\:(?P<port>\d+))?((?P<path>\/[^\?\#\n]*)(\?(?P<params>(?P<first_param>[^\#\?\&\=\n]+(=[^\#\?\&\=\n]*)*)(\&(?P<param_more>[^\#\?\&\=\n]+(=[^\#\?\&\=\n]*)*))*))?(\#(?P<tag>[^\#\?\n]+)?)?)?$" test_str = ("HTTP://www.empower54.org\n" "Http://the-woods.org/cv.pdf\n" "ftp://200.37.254.51/pub/METI%20Space%20Policy.pdf\n" "ftp://dossier.ogp.noaa.gov/GCOS/WMO-Normals/RA-II/OM/41256.TXT\n" "ftp://eclipse.ncdc.noaa.gov/pub/ibtracs/original-bt-data-files/nadi/RSMC%20Nadi%20BT%20Data%202007_8.txt\n" "ftp://ftp.atdd.noaa.gov/pub/GCOS/WMO-Normals/TABLES/REGIII/PY/86255.TXT\n" "ftp://ftp.atdd.noaa.gov/pub/GCOS/WMO-Normals/TABLES/REG_VI/PO/08515.TXT\n" "ftp://ftp.atdd.noaa.gov/pub/GCOS/WMO-Normals/TABLES/REG__I/M1/61291.TXT\n" "ftp://ftp.atdd.noaa.gov/pub/GCOS/WMO-Normals/TABLES/REG__V/MS/48665.TXT\n" "ftp://ftp.cordis.europa.eu/pub/fp7/ict/docs/ict-wp-2007-08_en.pdf\n" "ftp://ftp.dot.state.pa.us/public/Bureaus/BOMO/RM/RITS/Annual%20Electronic%20SLDs%20by%20County/District%209/Fulton%20Co.%20No%20Pipes.pdf\n" "ftp://ftp.dot.state.pa.us/public/pdf/BPR_PDF_FILES/MAPS/Type_10_GHS_Historical_Scans/Chester_1959_Sheet_1.pdf\n" "ftp://ftp.dot.state.pa.us/public/pdf/BPR_PDF_FILES/MAPS/Type_10_GHS_Historical_Scans/Delaware_1996.pdf\n" "ftp://ftp.ebi.ac.uk/pub/databases/chebi/\n" "ftp://ftp.fao.org/docrep/fao/009/x8750e/x8750e02.pdf\n" "ftp://ftp.fao.org/docrep/fao/010/a1250e/annexes/List%20of%20breeds%20documented%20in%20the%20Global%20Databank%20for%20Animal%20Genetic%20Resources/List_breeds.pdf\n" "ftp://ftp.fcc.gov/pub/Daily_Releases/Daily_Business/2011/db0608/DOC-307173A2.txt\n" "ftp://ftp.gps.caltech.edu/pub/avouac/OwensValley/Lienkaemperetal1987.pdf\n" "ftp://ftp.inf.ethz.ch/pub/crypto/publications/Maurer92b.ps\n" "ftp://ftp.math.ucla.edu/pub/camreport/cam04-71.pdf\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/Atl-Dis/2007053111.AXNT20\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/GuamStuff/2008051709-WTPN.PGTW\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/GuamStuff/2009061815-WDPN.PGTW\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/GuamStuff/2009090106-ABPW.PGTW\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/GuamStuff/2010031016-ABPW.PGTW\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/Outlook-A/2001/Aug/2001083109.ABNT20\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/Outlook-P/2004/Jul/2004072522.ABPZ20\n" "ftp://ftp.met.fsu.edu/pub/weather/tropical/Pac-Dis/2008052603.AXPZ20\n" "ftp://ftp.nada.kth.se/CVAP/reports/cvap159.pdf\n" "ftp://ftp.ncdc.noaa.gov/pub/data/normals/1981-2010/products/station/USC00305840.normals.txt\n" "ftp://ftp.ncdc.noaa.gov/pub/data/normals/1981-2010/products/station/USW00025339.normals.txt\n" "ftp://ftp.sam.math.ethz.ch/pub/sam-reports/reports/reports2010/2010-38.pdf\n" "ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/FAQ\n" "ftp://ftp.software.ibm.com/software/globalization/locales/France-French_Date.pdf\n" "ftp://ftp.software.ibm.com/software/globalization/locales/Nicaragua-Spanish_Date.pdf\n" "ftp://ftp.uni-potsdam.de/pub/WWW/clients/netscape/plugins/ifc/1.0/\n" "ftp://ftp2.sat.gob.mx/asistencia_servicio_ftp/publicaciones/ITDWeb/sat_plan_est.pdf\n" "ftp://iecc.com/pub/file/bliss.tar.gz\n" "ftp://rock.geosociety.org/pub/Memorials/v05/Duncan-HM.pdf\n" "ftp://rock.geosociety.org/pub/Memorials/v29/nafe.pdf\n" "ftp://tug.org/historic/systems/texlive/2003/live.pdf\n" "ftp://tug.org/historic/systems/texlive/2006/\n" "ftp://www.istorichka.ru/Periodika/Voprosy_Jazykoznanija/1976/1976_1.pdf\n" "git://git.savannah.gnu.org/gnash.git\n" "http://.go.com/mlb/stats/parkfactor\n" "http://0-content.ebscohost.com.helin.uri.edu/pdf19_22/pdf/2007/YQR/11Apr07/24963097.pdf?T=P&P=AN&K=24963097&S=R&D=a9h&EbscoContent=dGJyMNLr40SeprE4v%2BbwOLCmr0qepq5Srqi4TLSWxWXS&ContentCustomer=dGJyMPGvrki0ra9JuePfgeyx44Dt6fIA\n" "http://0-muse.jhu.edu.dewey2.library.denison.edu/article/12611\n" "http://0-search.credoreference.com.dewey2.library.denison.edu/content/entry/abcafatrle/latin_american_literature/0?institutionId=4607\n" "http://0-wwd.com.library.scad.edu/business-news/sourcing-global-markets/japan-fashion-week-fall-2016-10388614-10388614/\n" "http://0100101110101101.org/rot/\n" "http://059822.net/news/FS3.html\n" "http://1.bp.blogspot.com/-3pHlcUMnsyk/UgwjckLXs0I/AAAAAAAAYHQ/DkyiYAwWm8M/s1600/_ben.jpg\n" "http://10.1353/par.0.0047*\n" "http://10.asiae.co.kr/Articles/new_view.htm?a_id=2012013017592766335\n" "http://10.asiae.co.kr/Articles/new_view.htm?sec=ent3&a_id=2011032113184258354\n" "http://10.asiae.co.kr/Articles/new_view.htm?tsc=002005000&a_id=2009111708281332116&pg=\n" "http://100.empas.com/dicsearch/pentry.html?s=B&i=171078\n" "http://100.empas.com/dicsearch/pentry.html?s=B&i=209985&v=47\n" "http://100.empas.com/dicsearch/pentry.html?s=K&i=300001&v=44\n" "http://100.naver.com/100.nhn?docid=4790\n" "http://100.naver.com/100.nhn?docid=872348\n" "http://100.naver.com/100.nhn?docid=91049\n" "http://1000aircraftphotos.com/Contributions/HornDavid/9335.htm\n" "http://1000years.uazone.net/pub/Jukivka.doc\n" "http://100anosgalo.blogspot.com/2009/12/guerino-minervino-neto.html\n" "http://100years.akleg.gov/bio.php?id=717\n" "http://103.241.136.49/130124/entertainment-mollywood/article/celebrating-red-wine\n" "http://1033ampradio.radio.com\n" "http://1057thezone.iheart.com\n" "http://1066.co.nz/library/battle_abbey_roll2/battle_abbey_roll2.txt\n" "http://1067thebull.iheart.com/\n" "http://10kbullets.com/reviews/erotic-nights-of-the-living-dead\n" "http://10news.com./news/24382836/detail.html\n" "http://112.international/business-and-policy/Odesa-to-become-a-world-center-of-entertainment-Saakashvili-965.html\n" "http://1150wima.iheart.com\n" "http://11syyskuu.net/video/terror.wmv\n" "http://12.151.120.44/explore/studiolo/studiolo_hmpg.html\n" "http://123.63.242.116/pallavapuram/abt-muni.htm\n" "http://123telugu.com/slideshow/movies/Y/Yeto_Vellipoyindhi_Manasu_Track_List/1.html\n" "http://128.121.186.47/ISSA/reports/Balkan/Sep1903.htm\n" "http://12or20questions.blogspot.com/2007/09/12-or-20-questions-with-joshua-marie.html\n" "http://134.60.85.50:591/Earwig_online/FMPro?-db=distribution.fp5&-format=continents_erg.html&-lay=standard&-sortField=CountryRef&-sortorder=ascend&GenusEpithetonRef=Aborolabis%20pervicina&-find=\n" "http://140.247.119.138/OS_Homepage/\n" "http://142.176.62.102/scripts/esrimap.dll?name=nsplacenames&cmd=4&zoomcons=1&action=zoomToPlace&objid=24006&prov=false\n" "http://147.231.53.91/src/index.php?s=v&cat=3&bookid=68&page=351\n" "http://1476.orf.at\n" "http://14threunion.blogspot.com/2011/03/corps-of-signals-first-indian-signal.html\n" "http://150.254.171.193/ipac20/ipac.jsp?session=1E73DH1187659.747638&profile=bgpp&page=2&group=0&term=Rachunek+prawdopodobie%C5%84stwa+--+zadania+i+%C4%87wiczenia.&index=SW&uindex=&aspect=subtab14&menu=search&ri=1&source=~!bpp&1273951188119#focus\n" "http://152.111.1.87/argief/berigte/dieburger/1989/03/31/15/14.html\n" "http://152.111.1.87/argief/berigte/dieburger/2013/04/26/KS/23/oosVarsityspan.html\n" "http://152.111.1.88/argief/berigte/beeld/1993/12/14/4/14.html\n" "http://152.111.1.88/argief/berigte/beeld/2011/04/04/B1/2/polpdt3003.html\n" "http://155.83.192.50/wcscripts/pertdataNew.pl\n" "http://160.92.130.81/IMG/File/patnat/sites/60-55.pdf\n" "http://163.1.169.40/cgi-bin/library?e=d-000-00---0POxy--00-0-0--0prompt-10---4------0-1l--1-en-50---20-about---00031-001-1-0utfZz-8-00&a=d&c=POxy&cl=CL5.1.1&d=HASH018aae267b75be8320f99ba9\n" "http://163.1.169.40/cgi-bin/library?e=d-000-00---0POxy--00-0-0--0prompt-10---4----ded--0-1l--1-en-50---20-about-1708--00031-001-1-0utfZz-8-00&a=d&c=POxy&cl=CL5.1.2&d=HASH66d3681e4cf514d692ae08\n" "http://163.1.169.40/cgi-bin/library?e=d-000-00---0POxy--00-0-0--0prompt-10---4----ded--0-1l--1-en-50---20-about-P%2eOxy%2eI+0100--00031-001-1-0utfZz-8-00&a=d&c=POxy&cl=CL5.1.1&d=HASH018aae267b75be5ae0f99ba9\n" "http://163.1.169.40/cgi-bin/library?e=d-000-00---0POxy--00-0-0--0prompt-10---4----ded--0-1l--1-en-50---20-about-P.Oxy.I+0100--00031-001-1-0utfZz-8-00&a=d&c=POxy&cl=CL5.1.1&d=HASH018aae267b75be4b20f99ba9\n\n" "http://150.254.171.193/ipac20/ipac.jsp?session=1E73DH1187659.747638&profile=bgpp&page=2&group=0&term=Rachunek+prawdopodobie%C5%84stwa+--+zadania+i+%C4%87wiczenia.&index=SW&uindex=&aspect=subtab14&menu=search&ri=1&source=~!bpp&1273951188119#focus\n" "http://3g.163.com/ent/article/BRUCO0V9000333J5.html#adaptation=pc&refer=https%3A%2F%2Fm.baidu.com%2Ffrom%3D844b%2Fbd_page_type%3D1%2Fssid%3D0%2Fuid%3D0%2Fpu%3Dusm%25401%252Csz%25401320_2001%252Cta%2540iphone_1_9.1_3_601%2Fbaiduid%3DD08A12FD0E6ED4EFAE527096C1342EA0%2Fw%3D10_10_%2Ft%3Diphone%2Fl%3D1%2Ftc%3Fref%3Dwww_iphone%26lid%3D2887819655476323459%26order%3D1%26fm%3Dalop%26waplogo%3D1%26tj%3Dwww_normal_1_10_10_title%26vit%3Dosres%26waput%3D3%26cltj%3Dnormal_title%26asres%3D1%26nt%3Dwnor%26title%3D%25E9%259D%2592%25E5%25B9%25B4%25E9%2592%25A2%25E7%2590%25B4%25E6%25BC%2594%25E5%25A5%258F%25E5%25AE%25B6%25E6%259D%258E%25E6%2598%2580%253A%25E7%2583%25AD%25E7%2588%25B1%25E4%25BA%258B%25E4%25B8%259A%25E9%259C%2580%25E8%25A6%2581%25E6%2597%25B6%25E9%2597%25B4%25E7%259A%2584%25E7%25A7%25AF%25E6%25B7%2580_%25E7%25BD%2591%25E6%2598%2593%25E5%25A8%25B1%25E4%25B9%2590%26dict%3D20%26w_qd%3DIlPT2AEptyoA_ykzsO9bswFsRjUZtZJ7%26sec%3D22401%26di%3D91ef50a72f8cce69%26bdenc%3D1%26tch%3D124.0.320.182.0.0%26nsrc%3DIlPT2AEptyoA_yixCFOxXnANedT62v3IIxiJ_85CQXSxokDyqRKuVhEsRG3cASvTUS3cdSPQpqtjpUPY05Af7RJ0ra6nmW96kzm9u_%26eqid%3D281398ad240ea4001000000659649feb%26wd%3D%26clk_info%3D%257B%2522srcid%2522%253A%25221599%2522%252C%2522tplname%2522%253A%2522www_normal%2522%252C%2522t%2522%253A1499766769111%252C%2522sig%2522%253A%25224968%2522%252C%2522xpath%2522%253A%2522div-a-h3%2522%257D\n" "http://4um.bjork.com/viewtopic.php?p=598416#598416\n" "http://THSlone.tripod.com/MPEB.html#tokpisin\n" "http://aaronrasmussen.com/index/#/blindside/\n" "http://aas.org/grants/awards.php#pierce\n" "http://abc.go.com/primetime/privatepractice/index?pn=bios#t=character&d=25006\n" "http://abcnews.go.com/Politics/anti-abortion-activist-randall-terry-eyes-presidency-graphic/story?id=12639702#.UcxSXTvIEuc\n" "http://abcnews.go.com/US/grief-turn-loving-mom-sex-offender/story?id=14924854#.Tr5wnvKuGXs\n" "http://abcnews.go.com/US/yeardley-loves-mother-sues-convicted-uva-killer-george/story?id=16227560#.T-oiAZHw9kQ\n" "http://aberteke.walon.org/abertekes-engl.html#pweti-en\n" "http://access.bl.uk/item/viewer/lsidyv2e9f5636#ark:/81055/vdc_000000027695.0x00001C\n" "http://acharts.co/artist/cribs#albums\n" "http://actionspeaksradio.org/griswold-v-connecticut/#.UbZVV_mTgV0\n" "http://adoption.state.gov/country/china.html#who1\n" "http://advsys.net/ken/utils.htm#pngout\n" "http://afltables.com/afl/crowds/stkilda.html#02\n" "http://afltables.com/afl/seas/1990.html#lad\n" "http://afltables.com/afl/seas/2012.html#23\n" "http://afltables.com/afl/stats/2012.html#20\n" "http://africanelections.tripod.com/ne.html#2004_Presidential_Election\n" "http://aftenbladet.no/skatt/?do=search&firstname=karen+anette&lastname=stai&age=&taxYear=&fylke=0&kommune=0#\n" "http://agoraclass.fltr.ucl.ac.be/concordances/intro.htm#ju\n" "http://akaddesign.com/fulio/gandom-cafe/?lang=en#toggle-id-4-closed\n" "http://aktuelt.fo/gudrid+hansdottir+givid+ut+flogu+vid+7+logum+i+dag.html#.UwxI20IhCK0\n" "http://al-quran.info/#111:1\n" "http://alumnus.caltech.edu/~ejohnson/critics/ebert.html#y1996\n" "http://americanhistory.si.edu/JeffersonBible/the-book/?view=transcription&page=44#dl\n" "http://amiga.resource.cx/company/company.pl#phase5\n" "http://animals.nationalgeographic.com/animals/fish/clown-anemonefish/#\n" "http://appointments.gc.ca/prflOrg.asp?OrgID=HSM&lang=eng#PersonID_22267\n" "http://apps.webofknowledge.com/full_record.do?product=WOS&search_mode=GeneralSearch&qid=4&SID=4BgGUKx67aV9nKQYOk3&page=2&doc=13#\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/E78.6\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/G0.2\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/G95.1\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/H35.7\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/I23.0\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/I70.9\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/J20.5\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/J47\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/K10.8\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/K31.5\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/M31\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/O21.1\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/Q15.8\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/Q79\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/R02\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/T46.0\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/T57.0\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/T59.5\n" "http://apps.who.int/classifications/icd10/browse/2016/en#/T78.1\n" "http://arabic.arabianbusiness.com/politics-economics/society/2009/oct/29/30433/#.VpLNOPn5jIU\n" "http://archaeologydataservice.ac.uk/archiveDS/archiveDownload?t=arch-281-1/dissemination/pdf/cba_rr_079.pdf#p=122\n" "http://archive.adl.org/terror/tu/tu_0404_philippines.html#.VUgNa46qqko\n" "http://archive.aviationweek.com/issue/19720626/#!&pid=102\n" "http://archive.li/z13H#selection-3155.183-3155.280\n" "http://archives.newyorker.com/?i=1999-10-18#folio=172\n" "http://archivio.corriere.it/Archivio/interface/view.shtml#!/NjovZXMvaXQvcmNzZGF0aWRhY3AxL0AyMjI1Mg%3D%3D\n" "http://archrecord.construction.com/designVanguard/DesignVanguardPast.asp#2003\n" "http://artdaily.com/news/67296/-Clarice-Smith--Recollections-of-a-Life-in-Art--on-display-at-the-New-York-Historical-Society#.WNqT4qK1vIV\n" "http://au.encarta.msn.com/encyclopedia_761571330/Rutskoy_Aleksandr_Vladimirovich.html#461528998\n" "http://austriancharts.at/weekchart.asp?cat=d&year=2006&date=20060217#\n" "http://austringer.net/wp/?p=626#more-626\n" "http://ava.prri.org/#lgbt/2017/States/lgbt_ssm/m/US-SC\n" "http://az.lib.ru/c/chehow_a_p/text_0100.shtml#13\n" "http://babel.hathitrust.org/cgi/pt?id=nyp.33433066590823#view=1up;seq=96\n" "http://bahai-library.com/handscause_statistics_1953-63#89\n" "http://bea.gov/national/nipaweb/TableView.asp?SelectedTable=1&ViewSeries=NO&Java=no&Request3Place=N&3Place=N&FromView=YES&Freq=Qtr&FirstYear=2009&LastYear=2010&3Place=N&Update=Update&JavaBox=no#Mid\n" "http://bellamysorganic.com.au/blog/why-are-there-7-different-logos-for-organic-certification-in-australia/#.VO5yLvmUfTo\n" "http://bemaniwiki.com/index.php?beatmania%20IIDX%2022%20PENDUAL#j5c56c66\n" "http://bestsellery.zpav.pl/airplays/top/archiwum.php?year=2013&idlisty=864#title\n" "http://bestsellery.zpav.pl/airplays/top/archiwum.php?year=2017&idlisty=2259#title\n" "http://bie.ala.org.au/species/urn:lsid:biodiversity.org.au:apni.taxon:306345#\n" "http://bjorner.com/DSN07010%20-%201984%20Europe%20Tour.htm#DSN07120\n" "http://bjorner.com/DSN07660%20-%201986%20Down%20Under%20Tour.htm#DSN07720\n" "http://blackreelawards.wordpress.com/2012/12/19/black-reels-embraces-diverse-group-of-films/#more-1314\n" "http://bleacherreport.com/articles/1223253-ufc-148-silva-vs-sonnen-ii-and-the-10-most-awaited-bouts-in-mma#/articles/1223253-ufc-148-silva-vs-sonnen-ii-and-the-10-most-awaited-bouts-in-mma/page/11\n" "http://blog.chron.com/txpotomac/2013/07/filemon-vela-jr-explains-his-resignation-from-congressional-hispanic-caucus-says-immigration-foes-are-extracting-a-pound-of-flesh-as-price-of-reform/#13746101=0\n" "http://blog.chron.com/ultimateastros/2014/08/01/astros-calling-up-mike-foltynewicz/#22102103=0&25575101=0\n" "http://blog.sfgate.com/ontheblock/2016/12/10/in-the-wake-of-the-ghost-ship-fire-examining-oaklands-staggering-rent-hikes/#photo-781392\n" "http://blog.sfgate.com/thebigevent/2011/12/22/todays-special-best-christmas-movies-of-all-time/#2224101=0\n" "http://blogs.forward.com/the-arty-semite/148632/israeli-fashionistas-in-under--years/#ixzz2sMHpBnqO\n" "http://blogs.ft.com/beyond-brics/2012/04/24/sierra-leone-a-one-stock-shop/#axzz1yKETllWA\n" "http://blogs.indiewire.com/bent/14-films-you-must-watch-at-frameline-2014-20140617?page=2#blogPostHeaderPanel/\n" "http://blogs.indiewire.com/theplaylist/the-amazing-spider-man-takes-another-page-from-the-dark-knight-marketing-playbook-with-viral-ad-starring-denis-leary#\n" "http://blogs.myspace.com/index.cfm?fuseaction=blog.view&friendId=411057&blogId=530989674#bio\n" "http://blogs.myspace.com/index.cfm?fuseaction=blog.view&friendId=8202636&blogId=538572306#ixzz0ymuETGLj\n" "http://blogs.sciencemag.org/pipeline/archives/2005/10/11/the_old_stuff#44460\n" "http://blogs.usatoday.com/listenup/2008/09/this-weeks-re-4.html#more\n" "http://bloodstock.racingpost.com/dam/dam_home.sd?horse_id=4#damTabs=dam_progeny_sales\n" "http://bloodstock.racingpost.com/sales/results/individual_home.sd?tab=&st=8&l=&i=1&ob=ln&od=ASC&page=1&fv=131072&df=1993-11-29&dt=1993-12-02&venue_id=5&hn=Nicer&s=&a=&sin=&dn=&sdn=&vn=&b=&mip=&map=&lm=#individualResultsTabs=catalogue_5\n" "http://bloodstock.racingpost.com/sales/results/individual_home.sd?tab=&st=8&l=&i=1&ob=ln&od=ASC&page=1&fv=131072&df=1996-07-15&dt=1996-07-16&venue_id=6&hn=&s=&a=&sin=&dn=population&sdn=&vn=&b=&mip=&map=&lm=#individualResultsTabs=catalogue_6\n" "http://bloodstock.racingpost.com/sales/results/individual_home.sd?tab=&st=8&l=&i=1&ob=ln&od=ASC&page=1&fv=131072&df=2010-08-13&dt=2010-08-16&venue_id=36&hn=&s=&a=&sin=&dn=Sumora&sdn=&vn=&b=&mip=&map=&lm=#individualResultsTabs=catalogue_36\n" "http://board.byuu.org/viewtopic.php?f=9&t=2465&start=360#p94340\n" "http://boards.sportslogos.net/topic/93118-sports-graphics-packages-historically/page-4#entry2118163\n" "http://bobpark.physics.umd.edu/WN99/wn010899.html#2\n" "http://book.schooltool.org/htmlhelp/features.html#basic-use-cases") matches = re.finditer(regex, test_str, re.MULTILINE | re.IGNORECASE) 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