Regular Expressions 101

Save & Share

  • Regex Version: ver. 3
  • 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

/
/
mg

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 = ">.*<"; final String string = "injaseong1949@gmail.com>, Isaac Kim < \n" + "ibkim4@hotmail.com>, Johnny Kim < \n" + "johnnykim317@gmail.com>, Kyeongok Kang < \n" + "sarahkang100b@yahoo.com>, Kyu Han < \n" + "peterkyuhan@yahoo.com>, Kyu Lee < \n" + "kyujlee1@gmail.com>, Tae in Kim < \n" + "tikim58@gmail.com>, Yong Choi < \n" + "yongskchoi@gmail.com>, 강지연님 크리스찬 타임즈 < \n" + "vidakang@gmail.com>, 강호재님 < \n" + "hojaekang@gmail.com>, 권순화님 < \n" + "shn0802@gmail.com>, 김신영님 < \n" + "kimsy810@gmail.com>, 김영주님 < \n" + "lydiatree@gmail.com>, 김유신 목사님 < \n" + "kgmbc@hotmail.com>, 남소연님 < \n" + "esthersoyoun@hotmail.com>, 민영미님 < \n" + "mym0130@hanmail.net>, 박용돈님 < \n" + "ruthswalve@gmail.com>, 박은경 집사님 < \n" + "love0528@gmail.com>, 박종구님 < \n" + "askdad0824@gmail.com>, 박찬일님 < \n" + "cip717@yahoo.com>, 박해명님 < \n" + "hlan12@aol.com>, 신광희님 < \n" + "ky309512@gmail.com>, 아틀란타 기독일보 < \n" + "atldaily@gmail.com>, 유경희님 < \n" + "khyouchoi@gmail.com>, 이강평님 < \n" + "kplee@scu.ac.kr>, 이근상 목사님 < \n" + "lee@mykoreanchurch.org>, 이무희 장로님 < \n" + "moohleemd@gmail.com>, 이숙자 전도사님 < \n" + "sookja37@gmail.com>, 이원 장로님 < \n" + "wonlee38@gmail.com>, 이은조 전도사님 < \n" + "eunjol@hotmail.com>, 이의윤님 < \n" + "euiyunlee@gmail.com>, 이주배 장로님 < \n" + "jbcommon@gmail.com>, 이지환님 < \n" + "jeefanlee@gmail.com>, 이창향님 < \n" + "leejamiex@gmail.com>, 장현덕 집사님 < \n" + "bokchang22@yahoo.com>, 조선미님 < \n" + "smc129@hanmail.net>, 최낙신 목사님 < \n" + "nakchoi@gmail.com>, 최병주님 < \n" + "1268bj@hanmail.net>, 최병주 목사님 < \n" + "cbjmission@gmail.com>, 최승혁 목사님 < \n" + "bryan.choe@gmail.com>, 탁종희님 < \n" + "takjoanna@gmail.com>, 황미란 전도사님 < \n" + "miransh2006@gmail.com> Choanna Kim < \n" + "choannakim@gmail.com>, Choong Kim \n" + "lwgmc38@yahoo.com>, hyung kim < \n" + "hyungkm2006@gmail.com>, Tony Kim < \n" + "tony@sntmotorsusa.com>, Yoon Kim < \n" + "yoonie008@gmail.com>, 권태동님 < \n" + "kwon.61@gmail.com>, 김동일님 < \n" + "ddongil1023@gmail.com>, 김용웅 목사님 < \n" + "nambukbc@gmail.com>, 김인저님 < "; 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