Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
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]
  • Character class intersection
    [\w&&[^\d]]
  • 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
Processing...

Test String

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"['""]((?:[.]+|app)[^""]*user\.service)['""]|""([.]+[^""]*canvas-pan-zoom\.service)"""; string input = @"""./services/user.service"",""./services/utils.service"",""./services/query.service"",""./services/graph.service"",""./services/map-store.service"",""./map/label-maker.service"",""./editor/layout/label-layout.service"",""./editor/layout/tree-layout.service"",""./services/map-read-reducer.service"",""./services/interaction-reducer.service"",""./components/info-pane/info-pane.service"",""./map/map.service"",""./map/map-styling.service"",""./map/drawing-api.service"",""./map/canvas-render.service"",""./map/canvas-pan-zoom.service"",""./embed/embed.component""],function(exports_1,context_1){""use strict"";var core_1,router_1,http_1,user_service_1,utils_service_1,query_service_1,graph_service_1,map_store_service_1,label_maker_service_1,label_layout_service_1,tree_layout_service_1,map_read_reducer_service_1,interaction_reducer_service_1,info_pane_service_1,map_service_1,map_styling_service_1,drawing_api_service_1,canvas_render_service_1,canvas_pan_zoom_service_1,embed_component_1,AppComponent,__decorate=(context_1&&context_1.id,this&&this.__decorate||function(decorators,target,key,desc){var d,c=arguments.length,r=3>c?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if(""object""==typeof Reflect&&""function""==typeof Reflect.decorate), 'app/user.service', r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(""d=decorators[i])&&(r=(3>c?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}),__metadata=this&&this.__metadata||function(k,v){return""object""==typeof Reflect&&""function""==typeof Reflect.metadata?Reflect.metadata(k,v):void 0};return{setters:[function(core_1_1){core_1=core_1_1},function(router_1_1){router_1=router_1_1},function(http_1_1){http_1=http_1_1},function(user_service_1_1){user_service_1=user_service_1_1},function(utils_service_1_1){utils_service_1=utils_service_1_1},function(query_service_1_1){query_service_1=query_service_1_1},function(graph_service_1_1){graph_service_1=graph_service_1_1},function(map_store_service_1_1){map_store_service_1=map_store_service_1_1},function(label_maker_service_1_1){label_maker_service_1=label_maker_service_1_1},function(label_layout_service_1_1){label_layout_service_1=label_layout_service_1_1},function(tree_layout_service_1_1){tree_layout_service_1=tree_layout_service_1_1},function(map_read_reducer_service_1_1){map_read_reducer_service_1=map_read_reducer_service_1_1},function(interaction_reducer_service_1_1){interaction_reducer_service_1=interaction_reducer_service_1_1},function(info_pane_service_1_1){info_pane_service_1=info_pane_service_1_1},function(map_service_1_1){map_service_1=map_service_1_1},function(map_styling_service_1_1){map_styling_service_1=map_styling_service_1_1},function(drawing_api_service_1_1){drawing_api_service_1=drawing_api_service_1_1},function(canvas_render_service_1_1){canvas_render_service_1=canvas_render_service_1_1},function(canvas_pan_zoom_service_1_1){canvas_pan_zoom_service_1=canvas_pan_zoom_service_1_1},function(embed_component_1_1){embed_component_1=embed_component_1_1}],execute:function(){AppComponent=function(){function AppComponent(){this.title=""This is the Rhumbl App""}return AppComponent=__decorate([core_1.Component({selector:""rhumbl-app"",template:""\n <router-outlet></router-outlet>\n "",directives:[router_1.ROUTER_DIRECTIVES],providers:[router_1.ROUTER_PROVIDERS,http_1.HTTP_PROVIDERS,user_service_1.UserService,utils_service_1.UtilsService,map_store_service_1.MapStoreService,map_read_reducer_service_1.MapReadReducerService,interaction_reducer_service_1.InteractionReducerService,label_maker_service_1.LabelMakerService,label_layout_service_1.LabelLayoutService,tree_layout_service_1.TreeLayoutService,graph_service_1.GraphService,query_service_1.QueryService,map_service_1.MapService,map_styling_service_1.MapStylingService,info_pane_service_1.InfoPaneService,drawing_api_service_1.DrawingAPIService,canvas_render_service_1.CanvasRenderService,canvas_pan_zoom_service_1.CanvasPanZoomService]}),router_1.RouteConfig([new router_1.AsyncRoute({path:""/dashboard"",name:""Dashboard"",loader:function(){return System[""import""](""./build/dashboard/dashboard.component"; foreach (Match m in Regex.Matches(input, pattern)) { Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index); } } }

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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx