Regular Expressions 101

Save & Share

  • Save new Regex
    ctrl+s
  • Update 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
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

/
/
gm

Test String

Code Generator

Generated Code

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "(?<=QUALIFICATION\\n).*\\n.*\\n.*"; final String string = "Krishnaprio Dey\n" + "Mob: 9748990991\n" + "E-mail: dey.krishnaprio@icloud.com\n" + "Address: P-13B Kamdahari, Purbapara , Garia , Kolkata:700084\n" + "Date of Birth: November 08, 1994\n" + "OBJECTIVE\n" + "Professional with an MBA in Marketing offering organized nature, design and communication strengths to support business and customer\n" + "demands. Creative and engaging marketer, knowledgeable about Content Management, Video Editing, Social Media Marketing, SEMRush,\n" + "Content Creation, Social media marketing campaign development, blog writing, video editing, SEO, Competitor Analysis and Content\n" + "Marketing.\n" + "ACADEMIC QUALIFICATION\n" + " Particulers Board / Univ. School/college Year of % / CGPA\n" + " MBA IIEST, Shibpur School of Management Science (Marketing & HR) 2020 72.96\n" + " B Tech. ( Civil Engineering) KIIT University Kalinga Institute of Industrial Technology 2017 7.2\n" + "SKILLS\n" + "• Social Media Marketing • Adobe Photoshop Portfolio Link\n" + "• Content Management • Adobe Premiere Pro\n" + "• Content Creation • Campaign Management https://rb.gy/cqk9li\n" + "• Video Editing • Final Cut Pro\n" + "LANGUAGE KNOWN\n" + "English Native or Bilingual Proficiency.\n" + "Bengali Native or Bilingual Proficiency.\n" + "Hindi Native or Bilingual Proficiency.\n" + "Experience\n" + "Job Experience • Biorev LLC ( 9th September 2020 to present): Digitial Marketing Associate: • Content Management• Managed all Social\n" + " Media Accounts (LinkedIn, Facebook, Instagram, YouTube, Twitter) • Created campaigns for new products • Created Social\n" + " Media Strategy • Developed content for Email newsletter • Created and optimised leadership LinkedIn profile • Lead blog\n" + " process with company freelancers • Sourced candidates on Social Media Platforms for recruitment.\n\n" + " • Simplified Europe ( July 2020) : Social Media Marketing Intern: Managed all Social Media Accounts (LinkedIn,\n" + "Internships Facebook, Instagram, YouTube, Twitter) • Managed Scholarship of the campaign on facebook.\n" + " • Godrej & Boyce (May 2019 to July 2019)-Interio : Conducted Market research for “ Scope of Distribution model”\n" + " • World Vision India (March 2019 to July 2019) : Optimisation of Nutrition Bank facility and grievance redressal\n" + " • Rites India LTD. (May 2016 – June 2016)- Analysis of RCC Structures\n" + " • Mjunction Services LTD (May 2015–June 2015)-Comparing Mjunction with industry’s best practices\n" + "Accomplishments • Winner : Simplified Europe Creative Challenge 2020 : Content Creation. (Competitor Count: 450)\n" + " • Creator and admin of own blogging website: website: https://www.travelincredibleindia.org\n" + "TRAINING & CERTIFICATIONS\n" + " • Search Engine Optimisation: LinkedIn Learning, YouTube (Simpli-Learn)\n" + " • CEFR Level C1 – English- Advanced : British Council\n" + " • Digital Marketing Associate Certification (Facebook)- Ongoing\n" + "Certification • Photoshop - Intermediate\n" + " • Managerial Economics: Linkedin Learning\n" + " • Strategic Human Resource Management: NASBA, HR Certification Institute & Linkedin Learning\n" + " • MS Office ( Word + Powerpoint) : Advanced\n" + "PROJECTS & CHARTERS\n" + " • Answering the question: Telemarketing remains to be a prominent channel of sales & distribution in the 21st century\n" + " • Optimization of Nutrition Bank at World Vision India & Grievance Redressal\n" + "Projects • Organized Event at Mega International Trade Fair: Panel Discussion: Handled huge team of event managers\n" + " • National Entrepreneurship Awards 2018 : Organized workshop : Addressed a Mass\n" + " • Women Empowerment App: Felp (Accenture innovation jockey 2016\n" + " • Analysis of construction industry of USA at Mjunction Services Ltd.: 2015\n" + "EXTRA CURRICULER ACTIVITIES\n" + " • Software Skills: SEMRush, Ritetags, Canva, Piktochart, Adobe Photoshop, Final Cut Pro, Advanced MS Office (Word +\n" + "Softwares Powerpoint), Sony Vegas Pro X, Logic Pro X\n" + "& others • 5th Year- Rabindra Sangeet- Chandigarh School of Music (Pracheen Kala Kendra)- 2012\n" + " • 3rd Year- Classical Piano- Schaum School of Music- 2010\n" + "POSITIONS OF RESPONSIBILITY\n" + "Simplified Europe • Facebook and Instagram page editor\n" + " • Coordinator of Student’s “Events and Lectures Team” ( Handled a team of 10 to bring in the best of lectureres to the\n" + "SOMS, IIEST college)\n" + " • Active administrator: SOMS, IIEST, Shibpur: Facebook & LinkedIn page.\n" + " • Event Assistant Coordinator: Riff e Random (KIIT-Fest) 2016\n" + "KIIT University • Coordinator of Music Society: Session: 2016 to 2017\n" + " • 3rd Year- Classical Piano- Schaum School of Music- 2010\n" + " • Represented Graduation college, at Spring Fest IIT-KGP, 2015\n" + "VOLENTEERED WORK\n" + " • Google Local Guide: Level 7\n" + " • Contributor on TripAdvisor\n" + " • Received certificate of appreciation at: KIITFEST- 2016\n" + "Declaration: I hereby declare that the above furnished information is true to the best of my knowledge.\n" + "Date: 8th June 2021\n" + "Place: Kolkata S I G N A T U R E"; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(string); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(i)); } } } }

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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html