Regular Expressions 101

Save & Share

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

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 = "(?m)^\\h*#x?\\h+\\d+\\N+[^#]+"; final String string = "# SciTE settings for AutoIt v3\n" + "#\n" + "# Oct 25, 2015 - Jos\n" + "#\n" + "# *** Specify here your AutoIt Include directories ***\n" + "openpath.$(au3)=$(SciteDefaultHome)\\..\\include\n" + "openpath.beta.$(au3)=$(SciteDefaultHome)\\..\\beta\\include\n" + "# *** Specify here the name you want to use of the UDF header creator ***\n" + "UDFCreator=Your Name\n" + "#\n" + "au3=*.au3\n" + "filter.au3=AutoIt (au3)|$(au3)|\n" + "lexer.$(au3)=au3\n\n" + "# left for others but not in use anymore.\n" + "autoit3dir=$(SciteDefaultHome)\\..\n\n" + "#define the number of backup files you want to keep 0=none\n" + "backup.files=0\n\n" + "#define the activation of the ProperCase function using au3.api. 0=no change, 1=Propercase functions and keywords automatically\n" + "proper.case=0\n\n" + "## Debug Output Options (to permanent change your selection copy them to SciTEUser.Properties and change it there\n" + "# Debug MessageBox Option 2=\"All\" 1=\"No @extended\" 0=\"No @extended & @error\".\n" + "debug.msgbox.option=0\n" + "# Debug Console Option 3=\"All\" 2=\"No SystemTime\" 1=\"No SystemTime & Return\" 0=\"No SystemTime, Return & Error\".\n" + "debug.console.option=1\n" + "# Debug Trace Option 3=\"All\" 2=\"No SystemTime\" 1=\"No SystemTime & Return\" 0=\"No SystemTime, Return & Error\".\n" + "debug.trace.option=1\n" + "# extra propery used by AutoItAutoComplete.LUA to totally disable AutoComplete when set to 1\n" + "autocomplete.au3.disable=0\n" + "calltips.au3.disable=0\n\n" + "# AutoIt Pixmap information\n" + "import properties\\au3.pixmap\n" + "autoit.use.pixmaps=1\n" + "autoit.pixmap.function=$(autoit.pixmap.violet)\n" + "autoit.pixmap.variable=$(autoit.pixmap.gray)\n" + "autoit.pixmap.macro=$(autoit.pixmap.orange)\n" + "autoit.pixmap.keyword=$(autoit.pixmap.blue)\n" + "autoit.pixmap.library=$(autoit.pixmap.blue_library)\n" + "autoit.pixmap.preprocessor=$(autoit.pixmap.olive)\n" + "autoit.pixmap.special=$(autoit.pixmap.red_special)\n\n" + "# CreateTools()\n" + "autoit.CreateToolsStart=19\n" + "shortcuts.properties=$(SciteDefaultHome)\\shortcuts.properties\n\n" + "# Commands to compile / run your script\n" + "command.go.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /run /prod /ErrorStdOut /in \"$(FilePath)\" /UserParams $(1) $(2) $(3) $(4)\n" + "command.go.subsystem.$(au3)=1\n" + "command.compile.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /ShowGui /prod /in \"$(FilePath)\"\n" + "command.compile.filter.$(au3)=1\n" + "command.build.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /NoStatus /prod /in \"$(FilePath)\"\n" + "command.build.filter.$(au3)=1\n" + "# ----------------------------------------------------------------------------------------------------------------\n" + "# AutoitTools.lua will check if Beta is installed and use these te set the menu options\n" + "#x 00 Beta RUN\n" + "command.0.beta=Beta Run\n" + "command.0.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /run /beta /ErrorStdOut /in \"$(FilePath)\" /UserParams $(1) $(2) $(3) $(4)\n" + "command.name.0.$(au3)=Beta Run\n" + "command.save.before.0.$(au3)=1\n" + "command.shortcut.0.$(au3)=Alt+F5\n" + "#x 01 Beta AUT2EXE\n" + "command.1.beta=Beta Compile\n" + "command.1.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /NoStatus /beta /in \"$(FilePath)\"\n" + "command.name.1.$(au3)=Beta Compile\n" + "command.save.before.1.$(au3)=1\n" + "command.shortcut.1.$(au3)=Alt+F7\n" + "command.is.filter.1.$(au3)=1\n" + "#x 02 Beta Helpfile\n" + "command.2.beta=Beta Help\n" + "command.2.$(au3)=$(SciteDefaultHome)\\..\\beta\\Autoit3Help.exe \"$(CurrentWord)\"\n" + "command.name.2.$(au3)=Beta Help\n" + "command.subsystem.2.$(au3)=2\n" + "command.shortcut.2.$(au3)=Alt+F1\n" + "command.save.before.2.$(au3)=2\n\n" + "#x 03 Tylo's au3check program for Prod\n" + "command.3.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /Prod /AU3check /in \"$(FilePath)\"\n" + "command.name.3.$(au3)=SyntaxCheck Prod\n" + "command.shortcut.3.$(au3)=Ctrl+F5\n" + "command.save.before.3.$(au3)=1\n\n" + "#x 04 Tylo's au3check program for Beta\n" + "command.4.beta=SyntaxCheck Beta\n" + "command.4.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /beta /AU3check /in \"$(FilePath)\"\n" + "command.name.4.$(au3)=SyntaxCheck Beta\n" + "command.shortcut.4.$(au3)=Ctrl+Alt+F5\n" + "command.save.before.4.$(au3)=1\n" + "# ----------------------------------------------------------------------------------------------------------------\n" + "# 05 Open Explorer in Scriptdir\n" + "command.5.*=Explorer.exe /e,/select,\"$(FilePath)\"\n" + "command.name.5.*=Open Explorer in ScriptDir\n" + "command.shortcut.5.*=Ctrl+E\n" + "command.subsystem.5.*=2\n" + "command.save.before.5.*=2\n" + "command.replace.selection.5.*=0\n" + "command.quiet.5.*=1\n" + "# 06 AU3Info program\n" + "command.6.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /AU3info\n" + "command.name.6.$(au3)=AU3Info\n" + "command.shortcut.6.$(au3)=Ctrl+F6\n" + "command.subsystem.6.$(au3)=2\n" + "command.save.before.6.$(au3)=2\n" + "command.quiet.6.$(au3)=1\n" + "# 07 Test Run\n" + "command.7.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /test /run /prod /ErrorStdOut /in \"$(FilePath)\" /UserParams $(1) $(2) $(3) $(4)\n" + "command.name.7.$(au3)=Test Run\n" + "command.shortcut.7.$(au3)=Shift+F5\n" + "command.save.before.7.$(au3)=1\n" + "# 08 Test AUT2EXE\n" + "command.8.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /test /in \"$(FilePath)\"\n" + "command.name.8.$(au3)=Test Compile\n" + "command.shortcut.8.$(au3)=Shift+F7\n" + "command.save.before.8.$(au3)=1\n" + "# 09 Jos's Tidy formatting program for Autoit3\n" + "command.9.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /Tidy /in \"$(FilePath)\"\n" + "command.name.9.$(au3)=Tidy AutoIt Source\n" + "command.subsystem.9.$(au3)=0\n" + "command.save.before.9.$(au3)=1\n" + "command.shortcut.9.$(au3)=Ctrl+T\n" + "#~ command.is.filter.9.$(au3)=1\n" + "# 10 Giuseppe's CodeWizard program\n" + "command.10.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\CodeWizard\\CodeWizard.au3\" \"/StdOut\"\n" + "command.subsystem.10.$(au3)=1\n" + "command.name.10.$(au3)=CodeWizard\n" + "command.shortcut.10.$(au3)=Alt+W\n" + "command.save.before.10.$(au3)=2\n" + "command.replace.selection.10.$(au3)=1\n" + "command.quiet.10.$(au3)=1\n" + "# 12 lookfar's Koda FormDesigner\n" + "command.12.$(au3)=\"$(SciteDefaultHome)\\Koda\\FD.exe\" /Scite\n" + "command.subsystem.12.$(au3)=1\n" + "command.name.12.$(au3)=Koda(FormDesigner)\n" + "command.shortcut.12.$(au3)=Alt+m\n" + "command.save.before.12.$(au3)=2\n" + "command.replace.selection.12.$(au3)=1\n" + "command.quiet.12.$(au3)=1\n" + "# 14 Jos's SciTeConfig\n" + "command.14.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\SciteConfig\\SciteConfig.au3\"\n" + "command.name.14.$(au3)=SciTe Config\n" + "command.shortcut.14.$(au3)=Ctrl+1\n" + "command.subsystem.14.$(au3)=2\n" + "command.save.before.14.$(au3)=2\n" + "command.replace.selection.14.$(au3)=0\n" + "command.quiet.14.$(au3)=1\n" + "# 15 Update Source in Version repository\n" + "command.15.*=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /in \"$(FilePath)\" /Versioning_Commit\n" + "command.name.15.*=Version Update Source\n" + "command.save.before.15.*=1\n" + "command.shortcut.15.*=F12\n" + "# 16 Compare current Source with the source in the Version repository\n" + "command.16.*=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\AutoIt3Wrapper\\AutoIt3Wrapper.au3\" /in \"$(FilePath)\" /Versioning_ShowDiff\n" + "command.name.16.*=Version Diff Source\n" + "command.save.before.16.*=1\n" + "command.shortcut.16.*=Alt+F12\n" + "command.quiet.16.*=1\n" + "# 17 guinness SciTE Jump\n" + "command.17.$(au3)=\"$(SciteDefaultHome)\\..\\AutoIt3.exe\" \"$(SciteDefaultHome)\\\\SciTE Jump\\SciTE Jump.au3\"\n" + "command.name.17.$(au3)=SciTE Jump\n" + "command.shortcut.17.$(au3)=Alt+Q\n" + "command.subsystem.17.$(au3)=2\n" + "command.save.before.17.$(au3)=2\n" + "command.replace.selection.17.$(au3)=0\n" + "command.quiet.17.$(au3)=1\n\n" + "# Standard LUA Functions\n" + "# 18 Jump to Func quickly\n" + "command.name.18.$(au3)=Jump to Function Prod\n" + "command.mode.18.$(au3)=subsystem:lua,savebefore:yes\n" + "command.shortcut.18.$(au3)=Ctrl+J\n" + "command.18.$(au3)=InvokeTool AutoItGotoDefinition.GotoDefinition\n" + "# 19 Jump Beta function quickly\n" + "command.19.beta=Jump to Function Beta\n" + "command.name.19.$(au3)=Jump to Function Beta\n" + "command.mode.19.$(au3)=subsystem:lua,savebefore:yes\n" + "command.shortcut.19.$(au3)=Ctrl+Alt+J\n" + "command.19.$(au3)=InvokeTool AutoItGotoDefinition.GotoDefinition beta\n" + "# 20 Jump Back to original spot\n" + "command.name.20.$(au3)=Jump Back\n" + "command.mode.20.$(au3)=subsystem:lua,savebefore:yes\n" + "command.shortcut.20.$(au3)=Ctrl+Shift+J\n" + "command.20.$(au3)=InvokeTool AutoItGotoDefinition.JumpBack\n" + "# 21 List functions\n" + "command.name.21.$(au3)=List Functions\n" + "command.21.$(au3)=InvokeTool AutoItTools.FunctionsList\n" + "command.subsystem.21.$(au3)=3\n" + "command.mode.21.$(au3)=savebefore:no\n" + "command.shortcut.21.$(au3)=Alt+L\n" + "# 22 Replacement toggle LUA script for MONOSPACE font\n" + "command.name.22.$(au3)=Toggle Override Font\n" + "command.mode.22.$(au3)=subsystem:lua,savebefore:no\n" + "command.shortcut.22.$(au3)=Ctrl+F11\n" + "command.22.$(au3)=InvokeTool Tools.toggleOverrideFont\n" + "# 23 Available\n" + "command.name.23.$(au3)=\n" + "command.subsystem.23.$(au3)=\n" + "command.23.$(au3)=\n" + "command.shortcut.23.$(au3)=\n" + "command.save.before.23.$(au3)=2\n" + "# 24 Add a msgbox for debugging\n" + "command.name.24.$(au3)=Debug to MsgBox\n" + "command.subsystem.24.$(au3)=3\n" + "command.24.$(au3)=InvokeTool AutoItTools.DebugMsgBoxAdd\n" + "command.shortcut.24.$(au3)=Ctrl+Shift+D\n" + "command.save.before.24.$(au3)=2\n" + "# 25 Add a Console msg for debugging\n" + "command.name.25.$(au3)=Debug to Console\n" + "command.subsystem.25.$(au3)=3\n" + "command.25.$(au3)=InvokeTool AutoItTools.DebugConsoleWriteAdd\n" + "command.shortcut.25.$(au3)=Alt+D\n" + "command.save.before.25.$(au3)=2\n" + "# 26 Remove Console and MSGBOX debug lines\n" + "command.name.26.$(au3)=Debug Remove lines\n" + "command.subsystem.26.$(au3)=3\n" + "command.26.$(au3)=InvokeTool AutoItTools.DebugRemove\n" + "command.shortcut.26.$(au3)=Ctrl+Alt+Z\n" + "command.save.before.26.$(au3)=2\n" + "# 27 Add ConsoleWrite Trace lines\n" + "command.name.27.$(au3)=Trace: Add Trace Lines\n" + "command.subsystem.27.$(au3)=3\n" + "command.27.$(au3)=InvokeTool AutoItTools.TraceAdd\n" + "command.shortcut.27.$(au3)=\n" + "command.save.before.27.$(au3)=2\n" + "# 28 Add ConsoleWrite Function Trace lines\n" + "command.name.28.$(au3)=Trace: Add Func Trace Lines\n" + "command.subsystem.28.$(au3)=3\n" + "command.28.$(au3)=InvokeTool AutoItTools.FunctionTraceAdd\n" + "command.shortcut.28.$(au3)=\n" + "command.save.before.28.$(au3)=2\n" + "# 29 Remove Trace Console lines\n" + "command.name.29.$(au3)=Trace: Remove ALL Trace lines\n" + "command.subsystem.29.$(au3)=3\n" + "command.29.$(au3)=InvokeTool AutoItTools.AllTraceRemove\n" + "command.shortcut.29.$(au3)=\n" + "command.save.before.29.$(au3)=2\n" + "# 30 Comment Console and MSGBOX debug lines\n" + "command.name.30.$(au3)=DebugTrace: Comment ALL lines\n" + "command.subsystem.30.$(au3)=3\n" + "command.30.$(au3)=InvokeTool AutoItTools.AllComment\n" + "command.shortcut.30.$(au3)=Alt+Shift+D\n" + "command.save.before.30.$(au3)=2\n" + "# 31 UnComment Console and MSGBOX debug lines\n" + "command.name.31.$(au3)=DebugTrace: UnComment ALL lines\n" + "command.subsystem.31.$(au3)=3\n" + "command.31.$(au3)=InvokeTool AutoItTools.AllUncomment\n" + "command.shortcut.31.$(au3)=Alt+Ctrl+D\n" + "command.save.before.31.$(au3)=2\n" + "# 32 Open #include File\n" + "command.name.32.$(au3)=Open Include\n" + "command.mode.32.$(au3)=subsystem:lua,savebefore:no\n" + "command.shortcut.32.$(au3)=Alt+I\n" + "command.32.$(au3)=InvokeTool AutoItTools.OpenInclude\n" + "# 33 Open BETA #include File\n" + "command.33.beta=Open Include Beta\n" + "command.name.33.$(au3)=Open Include Beta\n" + "command.mode.33.$(au3)=subsystem:lua,savebefore:no\n" + "command.shortcut.33.$(au3)=Alt+Shift+I\n" + "command.33.$(au3)=InvokeTool AutoItTools.OpenBetaInclude\n" + "# 34 Generate UDF header\n" + "command.name.34.$(au3)=Make UDF Header\n" + "command.mode.34.$(au3)=subsystem:lua,savebefore:no\n" + "command.shortcut.34.$(au3)=Ctrl+Alt+H\n" + "command.34.$(au3)=InvokeTool AutoItTools.InsertFunctionHeader\n" + "# Commands to for Help F1\n" + "command.help.$(au3)=$(SciteDefaultHome)\\..\\Autoit3Help.exe \"$(CurrentWord)\"\n" + "command.help.subsystem.$(au3)=2\n" + "# Autocomplete and call tip settings\n" + "api.$(au3)=$(SciteDefaultHome)\\api\\au3.api;$(SciteDefaultHome)\\api\\au3.autoit3wrapper.api;$(SciteUserHome)\\au3.user.calltips.api\n" + "calltip.au3.word.characters=$(chars.alpha)$(chars.numeric)_.\n" + "calltip.au3.ignorecase=1\n" + "calltip.au3.end.definition=)\n" + "calltip.au3.parameters.separators=,\n" + "# set the style for separator character # Only available in SciTE4AutoIt3 version\n" + "calltip.au3.delimiter.style=8\n" + "# Display the calltip above the function # Only available in SciTE4AutoIt3 version\n" + "calltips.set.above=0\n" + "# Set the highlight color of the function argument # Only available in SciTE4AutoIt3 version\n" + "calltips.color.highlight=#FF0000\n" + "# Set the fore and back color of the calltip window\n" + "style.au3.38=fore:#050505,back:#FFFFFF\n\n" + "#\n" + "autocomplete.au3.ignorecase=1\n" + "autocomplete.au3.start.characters=$(chars.alpha)$(chars.numeric)$_@#\n" + "word.characters.$(au3)=$(chars.alpha)$(chars.numeric)$(chars.accented).$_@#\n" + "# Auto indent stuff\n" + "#~ indent.size.$(au3)=4\n" + "statement.indent.$(au3)=\n" + "statement.end.$(au3)=\n" + "statement.lookback.$(au3)=\n" + "block.start.$(au3)=5 case if do for func else elseif while select switch with\\\n" + " Case If Do For Func Else ElseIf While Select Switch With\\\n" + " CASE IF DO FOR FUNC ELSE ELSEIF WHILE SELECT SWITCH WITH\n" + "block.end.$(au3)=5 case else endif elseif endfunc endselect endswitch next until wend endwith\\\n" + " Case Else EndIf ElseIf EndFunc EndSelect EndSwitch Next Until Wend WEnd EndWith\\\n" + " CASE ELSE ENDIF ELSEIF ENDFUNC ENDSELECT ENDSWITCH NEXT UNTIL WEND ENDWITH\n" + "#Comments functions definition\n" + "comment.block.au3=;~\n" + "comment.block.at.line.start.au3=1\n" + "comment.stream.start.au3=#CS\n" + "comment.stream.end.au3=#CE\n" + "comment.box.start.au3=#CS\n" + "comment.box.middle.au3=;\n" + "comment.box.end.au3= #CE\n\n" + "# Import the seperate au3.keywords.properties file containing AutoIt3 info (based on script by Valik)\n" + "import properties\\au3.keywords\n" + "import properties\\autoit3wrapper.keywords\n" + "# Import the seperate au3.keywords.Abbreviations.properties file containing Abbreviation keywords supplied by Mhz\n" + "import properties\\au3.keywords.abbreviations\n" + "#\n" + "# Add the below lines to your SciTEUser.properties when you want to add User Abbreviations and UDFS\n" + "#import au3.keywords.user.abbreviations\n" + "#import au3.UserUdfs\n\n" + "# Autoit keywords\n" + "keywords.$(au3)=$(au3.keywords.keywords)\n" + "# Autoit functions\n" + "keywords2.$(au3)=$(au3.keywords.functions)\n" + "# Autoit macros\n" + "keywords3.$(au3)=$(au3.keywords.macros)\n" + "# Autoit Send Keys\n" + "keywords4.$(au3)=$(au3.keywords.sendkeys)\n" + "#Pre-Processor\n" + "keywords5.$(au3)=$(au3.keywords.preprocessor)\n" + "#Special\n" + "keywords6.$(au3)=$(au3.keywords.special) $(autoit3wrapper.keywords.special)\n" + "# Expand abbreviations\n" + "keywords7.$(au3)=$(au3.keywords.abbrev) $(au3.keywords.userabbrev)\n" + "# UDFS\n" + "keywords8.$(au3)=$(au3.keywords.udfs)\n" + "# UDFS User\n" + "keywords9.$(au3)=$(au3.keywords.user.udfs)\n\n" + "#Color Settings\n" + "#Background\n" + "style.au3.32=style.*.32=$(font.base),back:#F0F4F9\n" + "#CaretLineBackground\n" + "caret.line.back=#FFFED8\n" + "# Brace highlight\n" + "style.au3.34=fore:#0000FF,back:#F0F4F9\n" + "# Brace incomplete highlight\n" + "style.au3.35=fore:#009933,back:#F0F4F9\n" + "# White space\n" + "style.au3.0=fore:#000000\n" + "# Comment line\n" + "style.au3.1=fore:#008000,italics\n" + "# Comment block\n" + "style.au3.2=fore:#008000,italics\n" + "# Number\n" + "style.au3.3=fore:#0000FF\n" + "# Function\n" + "style.au3.4=fore:#000090\n" + "# Keyword\n" + "style.au3.5=fore:#0000FF\n" + "# Macro\n" + "style.au3.6=fore:#808000\n" + "# String\n" + "style.au3.7=fore:#FF0000\n" + "# Operator\n" + "style.au3.8=fore:#FF8000\n" + "# Variable\n" + "style.au3.9=fore:#5A5A5A\n" + "# Send keys in string\n" + "style.au3.10=fore:#808080\n" + "# Pre-Processor\n" + "style.au3.11=fore:#808000\n" + "# Special\n" + "style.au3.12=fore:#DC143C\n" + "#Abbrev-Expand\n" + "style.au3.13=fore:#FF0000\n" + "# COM Objects\n" + "style.au3.14=fore:#993399\n" + "#Standard UDF's\n" + "style.au3.15=fore:#0080FF\n" + "#User UDF's\n" + "style.au3.16=$(style.au3.15)"; final Pattern pattern = Pattern.compile(regex); 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