Regular Expressions 101

Save & Share

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

/
/
g

Test String

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "([ぁ-ヿ、]+)\n(.+)\n\n" Local $sString = "割れる(われる)" & @CRLF & _ "to break, to be smashed; to split, to crack, to fissure, to be torn; to be divided (opinion, vote, etc.), to split (e.g. of a party); to come to light, to become clear, to be identified, to be revealed; to be distorted (of a sound); to be divisible (without a remainder); to go below a minimum" & @CRLF & _ "" & @CRLF & _ "話す(はなす)" & @CRLF & _ "to talk, to speak, to converse, to chat; to tell, to explain, to narrate, to mention, to describe, to discuss; to speak (a language)" & @CRLF & _ "" & @CRLF & _ "燃える(もえる)" & @CRLF & _ "to burn, to get fired up" & @CRLF & _ "" & @CRLF & _ "辞書(じしょ)" & @CRLF & _ "dictionary, lexicon; letter of resignation" & @CRLF & _ "" & @CRLF & _ "なので" & @CRLF & _ "because, as, since" & @CRLF & _ "" & @CRLF & _ "なのに" & @CRLF & _ "and yet, despite this, but even so, but even then, however, nevertheless, for all that, notwithstanding that" & @CRLF & _ "" & @CRLF & _ "働く(はたらく)" & @CRLF & _ "to work, to labor, to labour; to function, to operate, to be effective, to work (i.e. ... works), to come into play; to commit (e.g. a crime), to perpetrate, to do, to act, to practise, to practice; to be conjugated" & @CRLF & _ "" & @CRLF & _ "動く(うごく)" & @CRLF & _ "to move, to stir, to shift, to shake, to swing; to operate, to run, to go, to work; to make a move, to take action, to act, to go into action; to be touched, to be influenced; to change, to vary, to fluctuate, to waver; to be transferred" & @CRLF & _ "" & @CRLF & _ "吊る(つる)" & @CRLF & _ "to hang, to suspend, to sling, to wear (e.g. a sword), to put up (e.g. a shelf); to hang oneself; to hoist an opponent off of his feet by his loincloth; to turn upwards (as if being pulled), to be slanted (of eyes); to pucker (e.g. of a seam), to be pulled tight" & @CRLF & _ "" & @CRLF & _ "必ず(かならず)" & @CRLF & _ "always, without exception, necessarily, certainly, without fail, positively, invariably" & @CRLF & _ "" & @CRLF & _ "気づく(きづく)" & @CRLF & _ "to notice, to recognize, to recognise, to become aware of, to perceive, to realize, to realise" & @CRLF & _ "" & @CRLF & _ "校訓(こうくん)" & @CRLF & _ "school precepts" & @CRLF & _ "" & @CRLF & _ "進捗(しんちょく)" & @CRLF & _ "progress, being under way" & @CRLF & _ "" & @CRLF & _ "助かる(たすかる)" & @CRLF & _ "to be saved, to be rescued, to survive; to escape harm, to be spared damage; to be helped, to be saved trouble" & @CRLF & _ "" & @CRLF & _ "補助(ほじょ)" & @CRLF & _ "assistance, support, aid, help; subsidy, supplement, subvention, grant-in-aid; auxiliary, subsidiary; spot (in bodybuilding)" & @CRLF & _ "" & @CRLF & _ "助言(じょげん)" & @CRLF & _ "advice, suggestion" & @CRLF & _ "" & @CRLF & _ "外注(がいちゅう)" & @CRLF & _ "outside order, outsourcing, custom (manufacture)" & @CRLF & _ "" & @CRLF & _ "返却(へんきゃく)" & @CRLF & _ "return of something, repayment" & @CRLF & _ "" & @CRLF & _ "発言(はつげん)" & @CRLF & _ "statement, remark, observation, utterance, speech, proposal" & @CRLF & _ "" & @CRLF & _ "十人十色(じゅうにんといろ)" & @CRLF & _ "several men, several minds, everyone has his own ideas and tastes, everyone has his own interests and ideas, different strokes for different folks" & @CRLF & _ "" & @CRLF & _ "理由(りゆう)" & @CRLF & _ "reason, pretext, motive" & @CRLF & _ "" & @CRLF & _ "自宅(じたく)" & @CRLF & _ "one's home, one's house" & @CRLF & _ "" & @CRLF & _ "在宅勤務(ざいたくきんむ)" & @CRLF & _ "working at home, telecommuting" & @CRLF & _ "" & @CRLF & _ "残業(ざんぎょう)" & @CRLF & _ "overtime (work)" & @CRLF & _ "" & @CRLF & _ "天狗(てんぐ)" & @CRLF & _ "tengu, long-nosed goblin; bragging, conceit, braggart, boaster, conceited person" & @CRLF & _ "" & @CRLF & _ "南京錠(ナンキンじょう)" & @CRLF & _ "padlock" & @CRLF & _ "" & @CRLF & _ "錠剤(じょうざい)" & @CRLF & _ "pill, lozenge, tablet" & @CRLF & _ "" & @CRLF & _ "悪魔(あくま)" & @CRLF & _ "devil, demon, fiend; Satan, the Devil; Māra, evil spirits or forces that hinder one's path to enlightenment" & @CRLF & _ "" & @CRLF & _ "紙ばさみ(かみばさみ)" & @CRLF & _ "paper holder, paper clip" & @CRLF & _ "" & @CRLF & _ "潜水艦(せんすいかん)" & @CRLF & _ "submarine" & @CRLF & _ "" & @CRLF & _ "消火栓(しょうかせん)" & @CRLF & _ "fire hydrant" & @CRLF & _ "" & @CRLF & _ "地球儀(ちきゅうぎ)" & @CRLF & _ "globe (map)" & @CRLF & _ "" & @CRLF & _ "三つ葉のクローバー(みつばのクローバー)" & @CRLF & _ "three-leaf clover" & @CRLF & _ "" & @CRLF & _ "工場(こうじょう)" & @CRLF & _ "factory, plant, mill, workshop" & @CRLF & _ "" & @CRLF & _ "トイレットペーパー" & @CRLF & _ "toilet paper" & @CRLF & _ "" & @CRLF & _ "蛇口(じゃぐち)" & @CRLF & _ "faucet, tap" & @CRLF & _ "" & @CRLF & _ "説明(せつめい)" & @CRLF & _ "explanation, exposition" & @CRLF & _ "" & @CRLF & _ "解説(かいせつ)" & @CRLF & _ "explanation, commentary, exposition, elucidation" & @CRLF & _ "" & @CRLF & _ "説得(せっとく)" & @CRLF & _ "persuasion" & @CRLF & _ "" & @CRLF & _ "まず" & @CRLF & _ "first (of all), firstly, to start with, above all; probably, almost (certainly), hardly, practically, more or less; anyway, at any rate, for now (at least), for the time being" & @CRLF & _ "" & @CRLF & _ "次(つぎ、つぐ、ジ)" & @CRLF & _ "next, order, sequence" & @CRLF & _ "" & @CRLF & _ "最後(さいご)" & @CRLF & _ "end, conclusion; last, final, latest, most recent; no sooner than, once, right after (often having negative consequences); one's final moments" & @CRLF & _ "" & @CRLF & _ "ツイート" & @CRLF & _ "tweet, Twitter post" & @CRLF & _ "" & @CRLF & _ "ボール" & @CRLF & _ "ball; ball (pitch that falls outside of the strike zone); bowl; board (cardboard, pasteboard, etc.)" & @CRLF & _ "" & @CRLF & _ "雪だるま(ゆきだるま)" & @CRLF & _ "snowman" & @CRLF & _ "" & @CRLF & _ "テント" & @CRLF & _ "tent" & @CRLF & _ "" & @CRLF & _ "看病人(かんびょうにん)" & @CRLF & _ "nurse" & @CRLF & _ "" & @CRLF & _ "スパナ" & @CRLF & _ "spanner, wrench" & @CRLF & _ "" & @CRLF & _ "恐竜(きょうりゅう)" & @CRLF & _ "dinosaur" & @CRLF & _ "" & @CRLF & _ "ゴルフ" & @CRLF & _ "golf" & @CRLF & _ "" & @CRLF & _ "砂時計(すなどけい)" & @CRLF & _ "hourglass" & @CRLF & _ "" & @CRLF & _ "弟子(でし)" & @CRLF & _ "pupil, disciple, adherent, follower, apprentice, young person, teacher's student-helper" & @CRLF & _ "" & @CRLF & _ "ショッピングカート" & @CRLF & _ "shopping cart" & @CRLF & _ "" & @CRLF & _ "熱気球(ねつききゅう)" & @CRLF & _ "hot-air balloon" & @CRLF & _ "" & @CRLF & _ "水桶(みずおけ)" & @CRLF & _ "pail (for water), bucket; cistern, water tank" & @CRLF & _ "" & @CRLF & _ "賞杯(しょうはい)" & @CRLF & _ "trophy, prize cup" & @CRLF & _ "" & @CRLF & _ "トロフィー" & @CRLF & _ "trophy" & @CRLF & _ "" & @CRLF & _ "並ぶ(ならぶ)" & @CRLF & _ "to line up, to stand in a line; to rival, to match, to equal" & @CRLF & _ "" & @CRLF & _ "困る(こまる)" & @CRLF & _ "to be troubled, to have difficulty, to be in a fix, to be at a loss, to be stumped, to be embarrassed; to be bothered, to be inconvenienced, to be annoyed; to be badly off, to be hard up, to be in straitened circumstances" & @CRLF & _ "" & @CRLF & _ "確認(かくにん)" & @CRLF & _ "confirmation, verification, validation, review, check, affirmation, identification" & @CRLF & _ "" & @CRLF & _ "早退(そうたい)" & @CRLF & _ "leaving early" & @CRLF & _ "" & @CRLF & _ "送る(おくる)" & @CRLF & _ "to send (a thing), to dispatch, to despatch, to transmit; to take or escort (a person somewhere), to see off (a person); to bid farewell (to the departed), to bury; to spend (time), to live one's life; to pass (down the line); to affix okurigana" & @CRLF & _ "" & @CRLF & _ "書類(しょるい)" & @CRLF & _ "document, official papers" & @CRLF & _ "" & @CRLF & _ "とのこと" & @CRLF & _ "I'm told, is what I heard, is how it is, apparently, is what they said" & @CRLF & _ "" & @CRLF & _ "撮影(さつえい)" & @CRLF & _ "photography (still or motion), photographing, filming, shooting, (video) recording" & @CRLF & _ "" & @CRLF & _ "優先順位(ゆうせんじゅんい)" & @CRLF & _ "priority, order of precedence" & @CRLF & _ "" & @CRLF & _ "必要(ひつよう)" & @CRLF & _ "necessary, needed, essential, indispensable; necessity, need, requirement" & @CRLF & _ "" & @CRLF & _ "気が抜ける(きがぬける)" & @CRLF & _ "to lose heart, to lose interest, to lose motivation, to be discouraged; to become stale (i.e. of a carbonated beverage), to go flat, to lose flavor, to lose flavour, to be exhausted, to feel spent" & @CRLF & _ "" & @CRLF & _ "出身(しゅっしん)" & @CRLF & _ "person's origin (e.g. city, country, parentage, school)" & @CRLF & _ "" & @CRLF & _ "弄ぶ(もてあそぶ)" & @CRLF & _ "to play with (a toy, one's hair, etc.), to fiddle with; to toy with (one's emotions, etc.), to trifle with; to do with something as one pleases; to appreciate" & @CRLF & _ "" & @CRLF & _ "聖(セイ、ひじり、ショウ)" & @CRLF & _ "holy, saint, sage, master, priest" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Created with Japanese for iOS®" & @CRLF & _ "" & @CRLF & _ "" Local $sSubst = "$1\t$1\t$2\n" Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst) MsgBox($MB_SYSTEMMODAL, "Result", $sResult)

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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm