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

/
/
mis

Test String

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"(?<=var\svars).*(?=\\n\\nif \(!var)"; string input = @";\n}\nvar vars = {\""uid\"":\""170785079\"",\""vid\"":171461352,\""oid\"":170785079,\""host\"":509202,\""vtag\"":\""493bf2f9dd\"",\""ltag\"":\""l_8f6ca452\"",\""vkid\"":171461352,\""md_title\"":\""6dfdbda80019208839183a713f243a41\"",\""md_author\"":\""Ayxan &#399;miraslanl\"",\""author_id\"":170785079,\""author_href\"":\""\\\/mr.ayxan\"",\""hd\"":3,\""no_flv\"":1,\""hd_def\"":-1,\""dbg_on\"":0,\""t\"":\""\"",\""duration\"":244,\""angle\"":0.000000,\""img_angle\"":0.000000,\""repeat\"":0,\""show_ads_preroll\"":0,\""show_ads_postroll\"":0,\""show_ads_promo_preroll\"":0,\""show_ads_overlay\"":0,\""ads_type\"":-1,\""legal_owner\"":0,\""eid1\"":0,\""slot\"":0,\""g\"":1,\""a\"":18,\""puid34\"":0,\""water_mark\"":\""\"",\""can_rotate\"":1,\""hash\"":\""19e3bc2d2ae2f2ce34f6fbaefcf93e2d\"",\""hash2\"":\""246f9680b9b4f835\"",\""is_vk\"":\""1\"",\""is_ext\"":\""0\"",\""referrer\"":\""\"",\""c3\"":\""\"",\""sample_id\"":-1,\""cat_id\"":13,\""sitezone\"":17,\""ads_preview\"":0,\""puid4\"":0,\""puid5\"":14,\""puid6\"":86,\""pl_type\"":\""other\"",\""nolikes\"":1,\""lang_add\"":\""Add to My Videos\"",\""lang_added\"":\""Video added to My Videos\"",\""lang_share\"":\""Share\"",\""lang_like\"":\""Like\"",\""lang_subscribe\"":\""Subscribe\"",\""lang_subscribed\"":\""You have subscribed\"",\""lang_volume_on\"":\""Unmute\"",\""lang_volume_off\"":\""Mute\"",\""lang_volume\"":\""Volume\"",\""lang_hdsd\"":\""Change Video Quality\"",\""lang_quality_auto\"":\""Auto\"",\""lang_open_popup\"":\""Expand\"",\""lang_fullscreen\"":\""Full Screen\"",\""lang_window\"":\""Minimize\"",\""lang_rotate\"":\""Rotate\"",\""lang_ads_link\"":\""Advertiser&#39;s Site\"",\""lang_ads\"":\""Ads\"",\""lang_ads_skip\"":\""Skip ad\"",\""lang_ads_skip_time\"":\""Skip ads in {time} s\"",\""lang_report_problem\"":\""Report a problem..\"",\""lang_replay\"":\""Replay\"",\""lang_next_cancel\"":\""Cancel\"",\""video_play_hd\"":\""Watch in HD\"",\""video_stop_loading\"":\""Stop Download\"",\""video_player_version\"":\""VK Video Player\"",\""goto_orig_video\"":\""Go to Video\"",\""video_get_video_code\"":\""Copy video code\"",\""video_load_error\"":\""The video has not uploaded yet or the server is not available\"",\""video_get_current_url\"":\""Copy frame link\"",\""lang_next\"":\""Next video\"",\""url240\"":\""https:\\\/\\\/cs509202.vk.me\\\/8\\\/u170785079\\\/videos\\\/493bf2f9dd.240.mp4?extra=SatA0TNoxI3a5jCGpYqhL9FIoS9kjnfIqvkVswFVnFDqJToNiAidxUb2ELSSrSEBNGEvU9Fiseuq5uEQSS_-afULYhnmxc6_vvsCA0mWSYbxDux-HA\"",\""url360\"":\""https:\\\/\\\/cs509202.vk.me\\\/8\\\/u170785079\\\/videos\\\/493bf2f9dd.360.mp4?extra=SatA0TNoxI3a5jCGpYqhL9FIoS9kjnfIqvkVswFVnFDqJToNiAidxUb2ELSSrSEBNGEvU9Fiseuq5uEQSS_-afULYhnmxc6_vvsCA0mWSYbxDux-HA\"",\""url480\"":\""https:\\\/\\\/cs509209.vk.me\\\/8\\\/u170785079\\\/videos\\\/493bf2f9dd.480.mp4?extra=SatA0TNoxI3a5jCGpYqhL9FIoS9kjnfIqvkVswFVnFDqJToNiAidxUb2ELSSrSEBNGEvU9Fiseuq5uEQSS_-afULYhnmxc6_vvsCA0mWSYbxDux-HA\"",\""url720\"":\""https:\\\/\\\/cs509209.vk.me\\\/8\\\/u170785079\\\/videos\\\/493bf2f9dd.720.mp4?extra=SatA0TNoxI3a5jCGpYqhL9FIoS9kjnfIqvkVswFVnFDqJToNiAidxUb2ELSSrSEBNGEvU9Fiseuq5uEQSS_-afULYhnmxc6_vvsCA0mWSYbxDux-HA\"",\""jpg\"":\""https:\\\/\\\/pp.vk.me\\\/c633320\\\/v633320079\\\/10dcc\\\/GDFulD47LS8.jpg\"",\""timeline_thumbs\"":1,\""timeline_thumbs_jpg\"":\""https:\\\/\\\/pp.vk.me\\\/c628028\\\/v628028079\\\/363df\\\/FVHRrSkD6HM.jpg,https:\\\/\\\/pp.vk.me\\\/c633322\\\/v633322079\\\/f06a\\\/CjskgJb-xxU.jpg\"",\""timeline_thumbs_per_row\"":10,\""timeline_thumbs_per_image\"":100,\""timeline_thumbs_total\"":122,\""timeline_thumb_width\"":133.000000,\""timeline_thumb_height\"":75,\""ip_subm\"":1,\""proxy\"":\""psv4\"",\""https\"":1,\""viewer_id\"":170785079,\""nologo\"":1,\""show_next\"":0,\""show_suggestions\"":0,\""liked\"":0,\""add_hash\"":\""0685c16b426a731323\"",\""added\"":0,\""can_add\"":0,\""no_title\"":0,\""vsegs_size\"":24.000000,\""vsegs_hash\"":\""1433edfd589e9d072b\"",\""module\"":\""direct\"",\""playlist_id\"":null};\n\nif (!var"; RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.Singleline; Match m = Regex.Match(input, pattern, options); 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