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]
  • 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

Substitution
Processing...

Code Generator

Generated Code

use strict; my $str = '### **UPSC Related Key Points and Key Facts** --- #### **1. Background and Formation of Jharkhand** - **Carved Out of Bihar:** - Formed on **November 15, 2000**, during PM Atal Bihari Vajpayee\'s tenure. - Alongside Chhattisgarh (from Madhya Pradesh) and Uttarakhand (from Uttar Pradesh). - Created to address tribal and regional aspirations, coinciding with **Birsa Munda\'s birth anniversary.** - **Structure Post-Bifurcation:** - Comprises **18 of Bihar’s 55 districts.** - Has **81 Assembly seats** and **14 Lok Sabha seats.** - Rich in mineral resources, but socioeconomically underdeveloped. - **Historical Demand:** - Tribal leader **Jaipal Singh Munda’s Jharkhand Party** fought for a separate state post-Independence. - Demand was initially rejected by the **States Reorganisation Commission** citing economic and agricultural concerns. --- #### **2. Political Landscape and Turmoil** - **Dominant Parties:** - **BJP** and **Jharkhand Mukti Morcha (JMM)** dominate state politics. - Other players: Congress, RJD, CPI, and **Jharkhand Vikas Morcha-Prajatantrik (JVM-P)** (formed by Babulal Marandi). - **Chief Ministers:** - Jharkhand has had **seven CMs** since 2000, reflecting political instability. - Only **Raghubar Das** (BJP, 2014-2019) completed a full term. --- #### **3. Electoral and Political History** - **2000-2005: Early Instability** - **Babulal Marandi (BJP):** First CM, but infighting led to his replacement by **Arjun Munda (BJP)** in 2003. - In 2005, JMM leader **Shibu Soren** briefly became CM but resigned within 10 days due to lack of majority. - **2006-2014: Turmoil and Alliances** - **Madhu Koda (Independent):** Became CM in 2006 but lost power after corruption allegations. - Frequent switches between Presidents\' Rule and short-lived alliances involving BJP, JMM, Congress, and Independents. - **Hemant Soren (JMM):** Became CM in 2013 for the first time after breaking with BJP. - **2014-2019: BJP Consolidation** - **Raghubar Das (BJP):** First non-tribal CM, completed a five-year term. - BJP’s 2014 Assembly win was driven by the **Narendra Modi wave.** - **2019-Present: JMM Resurgence** - **Hemant Soren (JMM):** Returned as CM after JMM-Congress alliance secured a majority. - Accusations of corruption led to his temporary resignation; **Champai Soren** served briefly as CM. --- #### **4. Challenges in Jharkhand’s Politics** - **Fragmentation and Alliances:** - No single party has won a clear majority in any Assembly election so far. - Frequent changes in government due to defections and coalition instability. - **Tribal vs Non-Tribal Leadership:** - Tribal leaders (Babulal Marandi, Hemant Soren) dominate discourse, but BJP experimented with a non-tribal CM in Raghubar Das. - **Corruption and Governance Issues:** - Several leaders, including Madhu Koda and Hemant Soren, have faced allegations of corruption. - Political instability has hindered long-term development. --- #### **5. Current Political Scenario** - **BJP:** - Led by **Babulal Marandi**, who returned to BJP in 2019 after leading JVM-P. - Raghubar Das now serves as Governor of Odisha. - **JMM:** - Hemant Soren continues to lead despite controversies, but internal rifts remain a concern. - Competing demands from tribal and non-tribal sections persist. --- ### **Mermaid Diagram** ```mermaid graph LR A[Formation of Jharkhand (2000)] --> B[Reasons for Creation] B --> B1[Tribal Aspirations] B --> B2[Birsa Munda Legacy] B --> B3[Rich Mineral Resources] A --> C[Political Landscape] C --> C1[BJP Dominance] C --> C2[JMM as Key Rival] C --> C3[Congress and Regional Players] A --> D[Timeline of Chief Ministers] D --> D1[Babulal Marandi (2000-2003)] D --> D2[Arjun Munda (2003-2005, 2010-2013)] D --> D3[Madhu Koda (2006-2008)] D --> D4[Hemant Soren (2013-Present)] A --> E[Challenges] E --> E1[Frequent Political Instability] E --> E2[Corruption Allegations] E --> E3[Tribal vs Non-Tribal Leadership] A --> F[Recent Developments] F --> F1[Babulal Marandi Returns to BJP] F --> F2[Hemant Soren Faces Corruption Allegations] F --> F3[Tribal Discontent and Economic Challenges] ``` '; my $regex = qr/^(.*?)\[(.*?)(\(.*?\).*?)\]$/mp; my $subst = '\\1\\[\\"\\2\\3\\"]'; my $result = $str =~ s/$regex/$subst/rg; print "The result of the substitution is' $result\n";

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 Perl, please visit: http://perldoc.perl.org/perlre.html