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 single character of: a, b, c or d
    [[ab][cd]]
  • 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
No Match

"
"
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

package main import ( "regexp" "fmt" ) func main() { var re = regexp.MustCompile(`(?m)(?m)^(\h*)maxlength:(?:\R\1(?!\h*maxlength_js_enforce:)(\h+).*)*$(?!\R\1\h)`) var str = `uuid: e3737897-ae40-4771-8aff-33d2fe76eeee langcode: de status: true dependencies: config: - config_pages.type.chatbot - field.field.config_pages.chatbot.field_2click_solution_label - field.field.config_pages.chatbot.field_2click_solution_logo - field.field.config_pages.chatbot.field_2click_solution_popup_text - field.field.config_pages.chatbot.field_title_div - field.field.config_pages.chatbot.field_url module: - field_group - field_states_ui - file - link - link_field_tweak - maxlength - text third_party_settings: field_group: group_struktur_definitionen: children: - group_tab_settings - group__tab_policy label: 'Chatbot Einstellungen' region: content parent_name: '' weight: 1 format_type: tabs format_settings: classes: '' show_empty_fields: false id: '' direction: horizontal width_breakpoint: 640 group_tab_settings: children: - field_url - field_2click_solution_logo - field_title_div label: Einstellungen region: content parent_name: group_struktur_definitionen weight: 20 format_type: tab format_settings: classes: '' show_empty_fields: false id: '' formatter: closed description: '' required_fields: true group__tab_policy: children: - field_2click_solution_label - field_2click_solution_popup_text label: Datenschutzhinweis region: content parent_name: group_struktur_definitionen weight: 21 format_type: tab format_settings: classes: '' show_empty_fields: false id: '' formatter: closed description: '' required_fields: true id: config_pages.chatbot.default targetEntityType: config_pages bundle: chatbot mode: default content: field_2click_solution_label: type: string_textfield weight: 22 region: content settings: size: 60 placeholder: '' third_party_settings: field_states_ui: form: type: '' list: '' add: Hinzufügen maxlength: maxlength_js: 60 maxlength_js_label: 'Inhalt auf @limit Zeichen begrenzt, verbleibend: <strong>@remaining</strong><br><br>' field_2click_solution_logo: type: file_generic weight: 22 region: content settings: progress_indicator: throbber third_party_settings: { } field_2click_solution_popup_text: type: text_textarea weight: 23 region: content settings: rows: 5 placeholder: '' third_party_settings: field_states_ui: form: type: '' list: '' maxlength: maxlength_js: null maxlength_js_label: 'Inhalt auf @limit Zeichen begrenzt, verbleibend: <strong>@remaining</strong>' maxlength_js_enforce: true maxlength_js_truncate_html: false field_title_div: type: string_textfield weight: 23 region: content settings: size: 60 placeholder: '' third_party_settings: { } field_url: type: link_default weight: 21 region: content settings: placeholder_url: 'URL zu einer JavaScript Datei' placeholder_title: '' third_party_settings: field_states_ui: form: type: '' list: '' add: Hinzufügen link_field_tweak: uri_part_custom_help: false uri_part_custom_help_text: '' maxlength: maxlength_js: null maxlength_js_label: 'Inhalt auf @limit Zeichen begrenzt, verbleibend: <strong>@remaining</strong>' hidden: label: true path: true ` var substitution = "$0\n$1$2maxlength_js_enforce: true" fmt.Println(re.ReplaceAllString(str, substitution)) }

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 Golang, please visit: https://golang.org/pkg/regexp/