Regular Expressions 101

Save & Share

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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

r"
"
gmi

Test String

Code Generator

Generated Code

# coding=utf8 # the above tag defines encoding for this document and is for Python 2.x compatibility import re regex = r"(?P<ordinary_killed>\"Ordinary.+killed\..+beast soul.+\")|(?P<primitive_killed>\"Primitive.+killed\..+beast soul.+\")|(?P<mutant_killed>\"Mutant.+killed\..+beast soul.+\")|(?P<sacred_blood_killed>\".*Sacred-blood.+killed\..+beast soul.+\")|(?P<super_killed>\".*Super.+killed.+beast soul.+\")|(?P<ordinary_hunted>\"Ordinary.+hunted\..+beast soul.+\")|(?P<primitive_hunted>\"Primitive.+hunted\..+beast soul.+\")|(?P<mutant_hunted>\".*Mutant.+hunted.+beast soul.+\")|(?P<sacred_blood_hunted>\".*Sacred-blood.+hunted.+beast soul.+\")|(?P<super_hunted>\".*Super.+hunted.+beast soul.+\")|(?P<ordinary_eaten>\".*ordinary.+eaten.+geno point.+\")|(?P<primitive_eaten>\".*Primitive.+eaten.+geno point.+\")|(?P<mutant_eaten>\".*Mutant.+eaten.+geno point.+\")|(?P<sacred_blood_eaten>\".*Sacred-Blood.+eaten.+geno point.+\")|(?P<super_eaten>\".*life essence.+eaten.+geno point.+\")|(?P<meat_eaten>\".*meat.+eaten.+geno point.+\")|(?P<super_consumed>\".*life essence.+consumed.+geno point.+\")|(?P<flesh_eaten>^\".*flesh.+eatan.+\"$)|(?P<killed_gainmax>\".*killed.+gain.+geno point.+\")|(?P<young_gained>\".*young.+geno point.+\")" test_str = ("\"Super Creature Desert Bird Killed. Beast Soul Of Desert Bird Gained. Life Essence Available. Meat Inedible.\"\n" "\"Sacred-blood Phantom Ant Killed. Beast Soul of Sacred-blood Phantom Ant Gained. Eat Its Meat to Gain Zero to Ten Sacred Geno Points Randomly.\"\n" "\"Primitive Creature Copper-Toothed Beast Killed. No Beast Soul Gained. Eat The Flesh Of Copper-Toothed Beast To Gain Zero To Ten Primitive Geno Points Randomly.\"\n" "\"Primitive Creature Copper-Toothed Beast Killed. Primitive Beast Soul Of Copper-Toothed Beast Gained. Eat The Flesh Of Copper-Toothed Beast To Gain Zero To Ten Primitive Geno Points Randomly.\"\n" "\"Sacred-blood Creature Scaled Armadillo Killed. Beast Soul of Scaled Armadillo Gained. Eat Its Meat to Gain Zero to Ten Sacred Geno Points Randomly.\"\n" "\"Primitive Quartz Scorpion Flesh Eaten. Four Primitive Geno Points Gained.\"\n" "\"Meat Of Sacred-Blood Shreeky Beast Eaten. One Sacred Geno Point Gained.\"\"Meat Of Sacred-Blood Shreeky Beast Eaten. One Sacred Geno Point Gained.\n" "\"Pet not transformed yet. Unable to use pet armor.\"\n" "\"Mutant Sawfish Killed. Beast Soul Of Mutant Sawfish Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Super Creature Evil Goblin Killed. No Beast Soul Gained. Life Essence Available. Meat Inedible.\"\n" "\"Super Creature Purgatory Flower Killed. No Beast Soul Gained. Life Essence Available.\"\n" "\"Life Essence Of Purgatory Flower Consumed. One Super Geno Point Gained.\"\n" "“Super Creature Nine-Tail Ghost Fox Killed. No Beast Soul Gained. Consume its Flesh to Gain Zero to Ten Super Geno Points Randomly. You may also Collect the Life Geno Essence.”\n" "\"Sacred-blood Creature Stormbird’s Egg Eaten. No Sacred Geno Point Gained.\"\n" "\"Sacred-Blood Color Shifter Killed. Beast Soul Of Sacred-Blood Color Shifter Gained. Eat Its Meat To Gain Zero To Ten Sacred Geno Points Randomly.\"\n" "\"Sacred-Blood Ghost-Eyed Bear Killed. Beast Soul Of Sacred-Blood Ghost-Eyed Bear Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points Randomly.\"\n" "\"Primitive Creature Swift Mantis Killed. No Beast Soul Gained. Eat the Swift Mantis to Gain Zero to Ten Primitive Geno Points Randomly.\"\n" "\"Primitive Creature Swift Mantis Killed. No Beast Soul Gained. Eat The Swift Mantis To Gain Zero To Ten Points Randomly.\">\"Primitive creature swift mantis killed ...\"\n" "\"Super Creature Blood Snail Killed. Beast Soul Of Super Creature Blood Snail Gained. Life Essence Available. Meat Inedible.\"\n" "\"Life Essence Of Super Creature Blood Snail Eaten. One Super Geno Point Gained.\"\n" "\"Life Essence Of Super Creature Blood Snail Eaten. One Super Geno Point Gained.\"\n" "\"Sacred-Blood Creature Beetle Knight Killed. Beast Soul Of Beetle Knight Gained. Meat Inedible.\"\n" "\"Sacred-Blood Creature Magic Horn Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points Randomly.\"\n" "\"Ghost-Toothed Snake King Meat Eaten. One Mutant Geno Point Gained.\"\n" "\"Mutant Sawfish Killed. No Beast Soul Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Mutant Sawfish Meat Eaten. One Mutant Geno Point Gained...\"\n" "\"Mutant Sawfish Meat Eaten. One Mutant Geno Point Gained...\"\n" "\"Life essence of super creature golden growler consumed. One super Geno point gained.\"\n" "\"Flesh Of Black Beetle Eaten. One Sacred Geno Point Gained.\"\n" "\"Flesh Of Black Beetle Eaten. One Sacred Geno Point Gained.\"\"Flesh Of Black Beetle Eaten. One Sacred Geno Point Gained.\"\n" "\"Sacred-Blood Copper-Toothed Beast Killed. No Beast Soul Gained. Eat Its Meat To Gain One To Ten Sacred Geno Points Randomly.\"\n" "\"Sacred-Blood Creature Tornado Wolf Killed. Beast Soul Of Tornado Wolf Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points Randomly.\"\n" "\"Super Creature Cloud Beast Killed. No Beast Soul Gained. Life Essence Available. Meat Inedible.\"\n" "\"Mutant Darkness Beast Killed. Beast Soul Of Mutant Darkness Beast Gained. Eat Its Meat To Gain 0 To 10 Mutant Geno Points Randomly.\"\n" "\"Identifying Beast Soul...\"\n" "\"Beast Soul Identified. Sacred-Blood Beast Soul Devil Sword Gained.\"\n" "\"Mutant Ghost-Toothed Snake King Killed. No Beast Soul Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Primitive Creature Green-Scaled Beast Killed. No Beast Soul Gained. Eat The Flesh Of The Primitive Green-Scaled Beast To Gain Zero To Ten Points Randomly.\"\n" "\"Sacred-Blood Creature Purple-Winged Dragon Killed. Sacred-Blood Beast Soul Of Purple-Winged Dragon Gained. Eat The Flesh Of Purple-Winged Dragon To Gain Zero To Ten Sacred-Blood Geno Points Randomly.\"\n" "\"Super Creature Cloud Beast Killed. No Beast Soul Gained. Eat Its Life Essence To Gain 0 To 10 Super Geno Points. Meat Inedible.\"\n" "\"Life Essence Of Super Creature Cloud Beast Eaten. One Super Geno Point Gained.\"\n" "\"Life Essence Of Super Creature Cloud Beast Eaten. One Super Geno Point Gained.\"\n" "\"Sacred-Blood Creature Mushu Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points Randomly.\"\n" "\"Mutant Creature Swamp Buffalo Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Mutant Geno Points Randomly.\"\n" "\"Sacred-Blood Creature Copper Demon Killed. No Beast Soul Gained. Drink Its Blood To Gain 0 To 10 Sacred Geno Points Randomly.\"\n" "\"Meat Of Sacred-Blood Ghost-Eyed Bear Eaten. One Sacred Geno Point Gained.\"\n" "\"Sacred-Blood Golden Rock Worm King Killed. Beast Soul Of Golden Rock Worm King Gained. Eat Its Meat To Gain Zero To Ten Sacred Geno Points Randomly.\"\n" "\"Sacred-Blood Black Stinger Killed. No Beast Soul Gained. Eat Its Meat To Gain Zero To Ten Sacred Geno Points Randomly.\"\n" "\"Mutant Black Stinger Killed. No Beast Soul Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Sacred-Blood Black Stinger Meat Eaten. One Sacred Geno Point Gained...\"\n" "\"Sacred-Blood Black Stinger Meat Eaten. One Sacred Geno Point Gained...\"\n" "\"Young Obsidian Dragon Killed. No Beast Soul Gained. Eat It to Gain Zero to Ten Sacred Geno Points Randomly.\" Having Barbecued It for a While, Han Sen Heard the Voice.\"\n" "\"Young Eaten. One Sacred Geno Point Gained...\"\n" "\"Primitive Creature Quartz Scorpion Killed. No Beast Soul Gain. Eat The Flesh Of Quartz Scorpion To Gain Zero To Ten Primitive Geno Points.\"\n" "\"Mutant Black-Feathered Beast Killed. Beast Soul Of Mutant Black-Feathered Beast Gained. Eat Its Meat To Gain Zero To Ten Primitive Geno Points.\"\n" "\"Primitive Creature Yellow Lion’S Meat Eaten. Zero Primitive Geno Point Gained.\"\n" "\"Sacred-Blood Ghost Butterfly Killed. Beast Soul Of Sacred-Blood Ghost Butterfly Gained. Meat Inedible.\"\n" "\"Sacred-Blood Ghost Butterfly Killed. Beast Soul Gained. Meat Inedible.\"\n" "\"Sacred-Blood Bloody Slayer Killed. Sacred-Blood Beast Soul Bloody Slayer Gained. Eat the Flesh of Bloody Slayer to Gain Zero to Ten Sacred Geno Points Randomly.\"\n" "\"Super Creature Golden Growler Killed. Beast Soul Of Golden Growler Gained. Life Essence Available. Meat Edible.\"\n" "\"Life Essence Of Golden Growler Consumed. One Super Geno Point Gained.\"\n" "\"Sacred-Blood Creature Skeleton King Killed. No Beast Soul Gained. Meat Inedible.\"\n" "\"Egg Broken. Identifying Beast Soul...\"\n" "\"Mutant Horned Sand Fox Killed. Beast Soul Of Mutant Horned Sand Fox Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Mutant Phantom Ant Killed. No Beast Soul Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Mutant Phantom Ant Killed. Beast Soul Of Mutant Phantom Ant Gained. Eat Its Meat To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Meat Of Copper-Toothed Beast Eaten. One Sacred Geno Point Gained.\"\n" "\"Primitive Sand Snake Killed. Beast Soul of Primitive Sand Snake Gained. Eat Its Meat to Gain Zero to Ten Geno Points Randomly.\"\n" "\"Mutant Copper-Toothed Beast Killed. No Beast Soul Gained. Eat Its Flesh To Gain Zero To Ten Mutant Geno Points.\"\n" "\"Mutant Copper-Toothed Beast Flesh Eaten. One Mutant Geno Point Gained.\"\n" "\"Primitive Black-Feathered Beast Killed. Beast Soul Of Primitive Black-Feathered Beast Gained. Eat Its Meat To Gain Zero To Ten Primitive Geno Pointes.\"\n" "\"Primitive Creature Black Lantern Fish Killed. No Beast Soul Gained. Eat Its Meat To Gain Zero To Ten Primitive Geno Points Randomly.\"\n" "\"Black Beetle Killed. No Beast Soul Gained. Eat The Flesh Of The Black Beetle To Gain Zero To Ten Geno Points Randomly.\"\"Black Beetle Flesh Eaten. Zero Geno Points Gained.\"\n" "\"Sacred-Blood Creature Black Beetle Killed. Beast Soul of Sacred-Blood Black Beetle Gained. Eat the Flesh of Sacred-Blood Black Beetle to Gain 0 to 0 Geno Points Randomly.\"\"Sacred-Blood Creature Black-Feathered Beast King Killed. Beast Soul Of Black-Feathered Beast King Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points.\"\n" "\"Primitive green-scaled beast flesh eaten. One primitive geno point gained.\"\n" "\"Larva Of Super Creature Cursed Wolf Killed. Beast Soul Of Cursed Wolf Gained. Life Essence Available. Meat Inedible.\"\n" "\"Larva of Super Creature Aqua Reaper Killed. Beast Soul of Super Creature Aqua Reaper Gained. Life Essence Available. Consume Its Life Essence to Gain 0 to 10 Super Geno Points Randomly. Meat Inedible.\"\n" "\"Life Essence Of Super Creature Aqua Reaper Consumed. No Super Geno Point Gained.\"\n" "\"Sacred-Blood Creature Ghost Butterfly Killed. Beast Soul Of Sacred-Blood Ghost Butterfly Gained. Meat Inedible.\"\n" "\"Super Creature White Jade Six-Legged Rhinoceros Killed. No Beast Soul Gained. Life Essence Available. Meat Inedible.\"\n" ">\"Evolution successful. Status of evolver gained. 100 years added to lifespan. Super body king spirit gained.\"\n" "\"Primitive Creature Ghost Butterfly Killed. No Beast Soul Gained. Meat Inedible.\"\n" "\"Primitive Creature Ghost Butterfly Killed. Beast Soul Of Primitive Ghost Butterfly Gained. Meat Inedible.\"\n" "\"Life Essence Of Super Creature Crystal Spirit Beast Consumed. One Super Geno Point Gained.\"\n" "\"Life Essence Of Cursed Wolf Eaten. One Super Geno Point Gained.\"\n" "\"Super Creature Silver-Winged Holy Butterfly Killed. No Beast Soul Gained. Eat The Flesh To Gain Zero To Ten Super Geno Points Randomly. You May Also Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Sacred-Blood Creature Hunted: Green Cloud Eagle. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Sacred-Blood Creature Inferno Bull Killed. Beast Soul Of Inferno Bull Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points.\"\n" "\"Super Creature Spirit Owl Killed. Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Primitive Creature Fire Prawn Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Primitive Geno Points.\"\n" "\"Mutant Creature Treasure Scallop Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Mutant Geno Points.\"\n" "\"Sacred-Blood Creature Hunted: Sky Falcon King. The Beast Soul Was Not Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Tiger-Wolf Beast Killed. No Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Obtain Zero To Ten Super Geno Points Randomly.\"\n" "\"Super Creature Muscle Beast Killed. No Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Obtain Zero To Ten Super Geno Points Randomly.\"\n" "\"Mutant Creature Hunted: Poison-Spike Sea Bug. The Beast Soul Was Not Acquired. Consume Its Flesh To Obtain A Random Amount Of Mutant Geno Points, Between Zero And Ten.\"\n" "\"Mutant Creature Hunted: Poison-Spike Sea Bug. The Beast Soul Has Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Mutant Geno Points, Between Zero And Ten.\"\n" "\"Princess Yin And Princess Yang Slew The Silver Beetle Mother. The Beast Soul Was Not Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Devil-Eye Spider Baby Killed. Beast Soul Gained. Eat The Flesh Of The Devil-Eye Spider Baby To Gain Zero To Ten Super Geno Points Randomly. You May Also Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Evolution Successful; You Have Achieved The Rank Of Surpasser. You Have Gained An Additional One-Hundred-Year Lifespan. Your Super Body Has Evolved – Super King Spirit.\"\n" "\"Super Creature Silver-Blood Macaque Killed. Beast Soul Gained. The Flesh Of This Creature Is Edible, And You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"You Have Obtained Title Of 'Tenth Son Of God.' Your Randomized Reward Is Opening.\"\n" "\"You Have Obtained A Super Beast Soul: Devil Unicorn.\"\n" "\"Super Beast Soul: Devil Unicorn. Possession Beast Soul.\"\n" "\"Berserk Sacred-Blood Creature Evil Gargoyle Killed. Beast Soul of Berserk Evil Gargoyle Gained. Meat Inedible.\"\n" "\"Super Creature Hunted: Uncompleted Build. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Five.\"\n" "\"You Have Consumed The Flesh Of A Super Creature; Your Super Geno Point Total Has Increased By One.\"\n" "\"Super Creature Hunted: Giant Frosty Bear. The Beast Soul Has Not Been Acquired. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Hunted: Saint-Bone Elephant. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten. You May Also Collect The Life Geno Essence.\"\n" "\"Super Creature Hunted: Fire-Scale T-Rex. The Beast Soul Has Been Acquired. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten.\"\n" "\"Primitive Creature Bluefish Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Primitive Geno Points.\"\n" "\"Sacred-Blood Creature Ghost-Pawed Ferret Killed. Beast Soul Of Sacred-Blood Ghost-Pawed Ferret Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points Randomly.\"\n" "\"Super Creature Cruel Witch Killed. No Beast Soul Gained. The Flesh Of This Creature Is Edible, And You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Super Creature Holy Lightshield Bug Killed. No Beast Soul Gained. The Flesh Of This Creature Is Edible, And You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Meat Of Golden Anchovy Eaten. One Primitive Geno Point Gained.\"\n" "\"Snow Charmer Killed Primitive Golden Swordfish. Beast Soul Of Golden Swordfish Gained. Eat Its Meat To Gain 0 To 10 Primitive Geno Points.\"\n" "\"Sacred-Blood Creature Snake Fish King Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points.\"\n" "\"Mutant Creature Hunted: Sacred-Blood Water Buffalo. the Beast Soul Was Not Acquired. Consume Its Flesh to Obtain a Random Amount of Sacred Geno Points, Between Zero and Ten.\"\n" "\"Meat Of Ghost-Pawed Ferret Eaten. One Sacred Geno Point Gained.\"\n" "\"Sacred-Blood Creature Hunted: Snow Bird. The Beast Soul Was Not Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Mutant Creature Hunted: Dark Silkworm. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Mutant Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Emerald Golem Killed. No Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Primitive Creature Golden Anchovy Killed. Beast Soul Of Golden Anchovy Gained. Eat Its Meat To Gain 0 To 10 Primitive Geno Points Randomly.\"\n" "\"Of Course This Is Awesome. Just Look At The Beast Souls They Use; They Are Sacred-Blood Ones.\"\n" "\"Moment Queen Killed The Super Creature Steel-Knight King. The Beast Soul Has Been Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Steel-Knight King Life Geno Essence Has Been Absorbed. You Have Received One Super Geno Point.\"\n" "\"Primitive Creature Snow Spider Killed. No Beast Soul Gained. Eat Its Meat To Gain 0 To 10 Primitive Geno Points.\"\n" "\"Mutant Creature Hunted: Subterranean Devil Ant Baby. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Mutant Geno Points, Ranging From Zero To Ten.\"\n" "\"Sacred-Blood Creature Hunted: Subterranean Devil Ant Baby. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Thunder-Devil Bull Killed. No Beast Soul Gained. The Flesh Of This Creature Is Edible, And You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Super Creature Mirage-Gas Freak Killed. No Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Super Creature Riverbank Wyrm Killed. No Beast Soul Gained. The Flesh Of This Creature Is Edible, And You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Sacred-Blood Creature Snow Spider Killed. No Beast Soul Gained. Eat Its Meat to Gain 0 to 10 Sacred Geno Points.\"\n" "\"Young Sacred-Blood Creature Evil-Blooded Condor Killed. Beast Soul of Evil-Blooded Condor Gained. Eat Its Meat to Gain 0 to 10 Sacred-Blood Geno Points.\"\n" "\"Essence Absorbed: Saint-Bone Elephant. You Have Gained One Super Geno Point.\"\n" "\"Essence Absorbed: Saint-Bone Elephant. You Have Gained One Super Geno Point.\"\n" "\"Announcement: The Second God'S Sanctuary'S Battle Arena Has Opened. Join The Battlegrounds, For The Holy Battles Begin In Thirty-Three Days.\"\n" "\"Sacred-Blood Creature Hunted: White-Ghost Butterfly. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Mutant Geno Points, Ranging From Zero To Ten.\"\n" "\"Mutant Creature Hunted: Dark Silkworm. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Mutant Geno Points, Ranging From Zero To Ten.\"\n" "\"Meat Of Evil-Blooded Condor Eaten. One Sacred Geno Point Gained.\"\n" "\"Super Creature Hunted: Death Knell. The Beast Soul Has Been Acquired. Its Flesh Cannot Be Consumed, But You May Collect The Life Geno Essence And Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Hunted: Thousand-Blade Blood Dragon Baby. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten.\"\n" "\"Thousand-Blade Blood Dragon Baby Consumed. You Have Received One Super Geno Point.\"\n" "\"Sacred-Blood Creature Silver Eel Killed. Beast Soul Of Silver Eel Gained. Eat Its Meat To Gain 0 To 10 Sacred Geno Points.\"\n" "\"Sacred-Blood Creature Hunted: Subterranean Devil Ant. The Beast Soul Has Not Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Mutant Geno Points, Ranging From Zero To Ten.\"\n" "\"Sacred-Blood Creature Hunted: Mountain Lizard. The Beast Soul Was Not Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Sacred-Blood Creature Hunted: Silver-Eye Ice Snake King. The Beast Soul Has Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred-Blood Geno Points, Ranging From Zero To Ten.\"\n" "\"Super Creature Hunted: Subterranean Devil Ant King Baby. The Beast Soul Has Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten.\"\n" "\"Subterranean Devil Ant King Baby Consumed. You Have Received One Super Geno Point.\"\n" "\"Sacred-Blood Creature Hunted: Subterranean Devil Ant Baby. The Beast Soul Has Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Sacred Geno Points, Ranging From Zero To Ten.\"\n" "\"Subterranean Devil Ant Baby Consumed. You Have Received One Sacred Geno Point.\"\n" "\"Subterranean Devil Ant Flesh Consumed. You Have Received One Sacred Geno Point.\"\n" "\"Super Creature Windhawk Killed. No Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Super Creature Flaming Minotaur Killed. No Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Super Creature Devil-Eye Spider Killed. No Beast Soul Gained. You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "\"Devil-Eye Spider Baby Consumed. One Super Geno Point Gained.\"\n" "\"Devil-Eye Spider Consumed. One Super Geno Point Gained.\"\n" "\"Mutant Creature Bloodlust Mosquito Killed. No Beast Soul Gained. Eat The Flesh Of The Mutant Creature Bloodlust Mosquito To Gain Zero To Ten Geno Points Randomly.\"\n" "\"Sacred-Blood Bloodlust Mosquito Killed. No Beast Soul Gained. Eat The Flesh Of The Sacred-Blood Creature Bloodlust Mosquito To Gain Zero To Ten Geno Points Randomly.\"\n" "\"Berserk Ice-Armored Beast Killed. Beast Soul Of Berserk Ice-Armored Beast Gained. Eat Its Meat To Gain 0 To 10 Primitive Geno Points.\"\n" "\"Berserk Sacred-Blood Creature Inferno Gargoyle Killed. No Beast Soul Gained. Meat Inedible.\"\n" "\"Sacred-Blood Creature White Goose Killed. Beast Soul Gained. Eat Its Flesh To Gain Zero To Ten Sacred Geno Points Randomly.\"\n" "\"Super Creature Hunted: Deadeye Peacock. The Beast Soul Has Been Acquired. Consume Its Flesh To Obtain A Random Numeric Amount Of Super Geno Points, Ranging From Zero To Ten.\"\n" "“Super Twin-Thunder Knight Beast Soul Obtained.”\n" "\"Mutant Pet Beast Soul Obtained; Dragon-Blood Snake.\"\n" "\"Mutant Dragon-Blood Snake: Second Gene Lock Open.\"\n" "\"Mutant Dragon-Blood Snake: First Gene Lock Open\"\n" "\"Mutant Dragon-Blood Snake: First Gene Lock Open.\"\n" "\"Mutant Dragon-Blood Snake: Sixth Gene Lock Open.\"\n" "\"Ordinary Creature Tree Crab Killed. No Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Ordinary Geno Points Randomly.\"\n" "“Berserk Mutant Creature Devil-Horn Sheep killed. No beast soul gained. This creature cannot be consumed.”\n" "“Super Creature Devil-Horn Sheep King killed. Beast soul gained. Its flesh is inedible and there is no Life Geno Essence for retrieval.”\n" "\"Sacred-Blood Creature Iron Bug King Killed. Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Sacred Geno Points Randomly.\"\n" "“Ordinary Creature Red-Eye Rabbit killed. No beast soul gained. Consume its flesh to gain zero to ten ordinary geno points randomly.”\n" "“Berserk Super Creature Transparent King Scorpion Killed. Beast Soul Gained. the Flesh of This Creature Is Inedible, but You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly.”\n" "“Super Creature Devil Fang King Killed. Beast Soul Gained. the Flesh of This Creature Is Edible, and You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly.”\n" "“Sacred-Geno Point +1.”\n" "\"Ordinary Creature Dollar Toad Killed. No Beast Soul Gained. Consume Its Flesh To Obtain Zero To Ten Ordinary Geno Points Randomly.\"\n" "\"Super Body Exhausted; Super King Spirit Status Cannot Be Maintained.\"\n" "\"Super Body Exhausted; Super King Spirit Status Cannot Be Maintained.\"\n" "\"Mutant Creature Gold Thunder-Hawk Killed. No Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "\"Mutant Creature Gold-Talon Wolf Killed. Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "“Super King Self Spirit Gene +1.”\n" "“Super King Self Spirit Gene +1.”\n" "“Ordinary-Class Blood Fly Beast Soul Obtained.”\n" "“Life Geno Essence Absorbed; Super Geno Point +1.”\n" "\"Ordinary Creature Flaming Porcupine Killed. Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Ordinary Geno Points Randomly.\"\n" "\"Super Creature Disloyal Knight Killed. Beast Soul Gained. The Flesh Of This Creature Is Inedible, But You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence To Gain Zero To Ten Super Geno Points Randomly.\"\n" "“Super Creature Nine-Tail Ghost Fox Killed. No Beast Soul Gained. Consume its Flesh to Gain Zero to Ten Super Geno Points Randomly. You may also Collect the Life Geno Essence.”Time King Spirit Geno Point +1Time King Spirit Geno Point +1.”\n" "“Super Creature Abyssal Beast killed. Beast Soul Gained. The Flesh of This Creature Is Inedible, but You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly.”\n" "“Sacred-Blood Creature Devil-Blood Mantis Killed. Beast Soul Gained. Consume Its Flesh to Gain Zero to Ten Sacred Geno Points Randomly.”\n" "“Sacred-Blood Creature Green Falcon Killed. No Beast Soul Gained. Consume Its Flesh to Gain Zero to Ten Sacred Geno Points Randomly.”\n" "\"Sacred-Blood Creature Loyal Knight Killed. No Beast Soul Gained. The Flesh Is Inedible.\"\n" "“Super Creature Sky Peacock Killed. Beast Soul Gained. The Flesh of This Creature Is Inedible, but You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly.”\n" "\"Mutant Creature Pillar Titan Killed. Beast Soul Gained. Consume Its Flesh Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "“Sacred-Blood Purple-Butterfly Orchid Consumed: Sacred-Blood Geno Points +1.”\n" "“Mutant Creature Hunted Tank Ant Killed. No Beast Soul Gained. Consume its Flesh to Gain Zero to Ten Mutant Geno Points \n" "“Mutant Tank Ant Consumed, Mutant Geno Points +1.”\n" "\"Ordinary Creature Black Iron Tiger Killed. No Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Ordinary Geno Points Randomly.\"\n" "“Sacred-Blood Creature Ghost Fang Killed. No Beast Soul Gained. Consume Its Flesh to Gain Zero to Ten Sacred Geno Points Randomly.”\n" "“Blood-Demon Fruit Has Not Yet Matured; Beast Soul Creation Cannot Be Completed.”\n" "“Ordinary-Class Blood Firefly Beast Soul Gained.”\n" "“Primitive-Class Blood-Ant Beast Soul Gained.”\n" "“Ordinary-Class Blood-Spider Beast Soul Gained.”\n" "“Ordinary-Class Blood Turtle Beast Soul Obtained.”\n" "“Super Creature Ice Wolf God Killed. Beast Soul Gained. the Flesh of This Creature Can Be Consumed, and You May Also Harvest Its Life Geno Essence. Consume Its Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly. Will You Accept the Beast Soul?”\n" "\"Mutant Creature Thorn Bug Killed. No Beast Soul Gained. Consume Its Flesh To Gain Zero To Ten Mutant Geno Points Randomly.\"\n" "“Super Creature Devil-Blood Mantis Killed. Beast Soul Gained. the Flesh of This Creature Is Inedible, but You May Harvest Its Life Geno Essence. Consume Its Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly.”\n" "“Super-class Thunder Hammer Beast Soul Obtained.”\n" "“Would you like to absorb the Battle Gene Thunder Hammer?”\n" "\"Dollar Toad Consumed. You Have Received One Ordinary Geno Point.\"\n" "“Obtained Blood River King’s Battle Geno Essence.”\n" "“Obtained Blood River King’s Battle Geno Essence.”\n" "“Sacred-Blood Creature Lightning Wolf killed. Beast soul gained. Consume its Flesh to Gain Zero to Ten Sacred Geno Points Randomly.”\n" "“Sacred-Blood Creature Thorn Scorpion Killed. Beast Soul Gained. Consume Its Flesh to Gain Zero to Ten Sacred Geno Points Randomly.”\n" "“Obtained Emperor Geno Core Blow Blood.”\n" "“Super Creature Bloodthirsty Ant King Killed. Beast Soul Gained. Geno Core Unobtained. Flesh Inedible. Consume the Life Geno Essence to Gain Zero to Ten Super Geno Points.”\n" "“Ordinary Creature Soil Lotus Killed. No Beast Soul Gained. Bronze Geno Core Received: Dust Bug. Consume Its Flesh to Gain Zero to Ten Ordinary Geno Points Randomly.”\n" "“Super Geno Core Split-Knife Obtained.”\n" "“Life Geno Essence absorbed. Super Geno Points +1.”\n" "“Super Creature Mountain River Beast Killed. No Beast Soul Gained. Geno Core Destroyed. the Flesh Is Edible. Claim the Life Geno Essence to Gain Zero to Ten Super Geno Points Randomly.”\n" "“Xenogeneic Baron Hunted; Xenogeneic Gene Found. Xenogeneic Beast Soul Obtained.”\n" "“Xenogeneic Viscount Hunted; Xenogeneic Gene Found: Old Elephant Man”\n" "“Xenogeneic Baron hunted; Xenogeneic Gene Found.”\n" "“Xenogeneic Viscount Hunted; Xenogeneic Gene Found: Purple-Horn Demon.”\n" "“Mutant Xenogeneic King hunted: Gold Demon Bug King. Xenogeneic gene found.”\n" "“Mutant Xenogeneic King hunted: Gold Demon Bug King. Xenogeneic gene found.”\n" "“Mutant Xenogeneic King hunted: Gold Demon Bug King. Xenogeneic gene found. Obtained Mutant Gold Demon Bug beast soul.”\n" "“Mutant Xenogeneic King hunted: Green Demon Bug King. Xenogeneic gene found. Obtained Mutant Green Demon Bug beast soul.”\n" "“Mutant Xenogeneic Marquise killed. Petrified Demon Cow: mutant xenogeneic gene found. Obtained mutant xenogeneic beast soul.”\n" "“Xenogeneic Gene Discovered.” \n" "“Xenogeneic Earl Hunted. Forest Bird: Xenogeneic Gene Found.”\n" "“Earl Gene +1”\n" "“Earl Class Xenogeneic Geno Art Obtained: Ant Queen Mark”\n" "“Successful infusion of deified gene. Deified gene +1. Deified progress is 1/100.”\n" "“Mutant Deified Xenogeneic Hunted: Blood Eye Evil God. Mutant Xenogeneic Gene Found. Obtained Blood Eye Evil God Beast Soul.”\n" "“Xenogeneic King hunted: Move Mountain Sea Conch. Xenogeneic gene found. Obtained beast soul.”\n" "“Xenogeneic Duke hunted. Xenogeneic gene found. Obtained beast soul.”\n" "“Xenogeneic Duke Metal Doll hunted. Xenogeneic gene found. Obtained beast soul.”\n" "“Deified Xenogeneic Killed: Four-Eyed Wolf. Xenogeneic Gene Found.”\n" "“Core deified xenogeneic hunted: Six Core God Snake. Deified xenogeneic gene found. Obtained Six Core God Snake beast soul.”\n" "“Deified gene +1. Deified progress: 30/100”\n" "“Deified gene +1. Deified progress: 40/100...”\n" "“Deified gene +1. Deified progress: 56/100”\n" "“Deified gene +1. Deified progress: 98/100”\n" "“Deified gene +1. Deified progress: 100/100... God body evolving...”\n" "“Xenogeneic deified hunted: Tianxia Peacock King. Xenogeneic gene found. Obtained Tianxia Peacock King beast soul.”\n" "“God Body Evolution Complete. Battle Body Leveled Up to Deified Class...”\n" "“Xenogeneic deified hunted. Time Ghost: Deified xenogeneic gene found. Obtained Time Ghost deified beast soul.”\n" "\"Xenogeneic Deified Hunted. Sky Star Wolf: Xenogeneic Deified Gene Found. Obtained Sky Star Wolf Deified Beast Soul.\"\n" "\"Xenogeneic Deified Hunted. Sky Star Wolf: Xenogeneic Deified Gene Found. Obtained Sky Star Wolf Deified Beast Soul.\"\n" "\"Xenogeneic Deified Hunted. Cold Light Charm: Deified Xenogeneic Gene Found. Obtained Cold Light Charm Beast Soul.\"\n" "\"Xenogeneic Deified Hunted. Black Demon Ape: Deified Xenogeneic Gene Found.\"\n" "\"God Spirit Hunted. Found God Spirit Gene.\"\n" "“Perfect God Spirit Blood-Pulse.” \n" "“Got god class gene race Holy Wen White Deer.”\n" "“Got Blood Dragon God Genes. Blood Dragon God Pulse Opened.” \n" "“Successfully combined with the blood ghost spirit. Got gene to combine skill Evil Blood.”\n" "“Break World gene plus one.”\n" "“Evolution requirement reached. Super God Spirit mode is evolving.”\n" "“Break World Beast Hunted: Ultimate Tail Fire Beast. Found Break World Gene.”\n" "Fifteenth Sky Leader: Han Sen\n" "“Killed God Spirit Gene Race: Decapitation Queen. Found an Annihilation-class God Base.”\n" "“Got Mutant God Class Gene Race Gold Wing Peacock King.”\n" "“Got mutant god class gene race blood ghost spirit.”\n" "“Got Mutant God-class Gene Race Blood Dragon.”") matches = re.finditer(regex, test_str, re.MULTILINE | re.IGNORECASE) for matchNum, match in enumerate(matches, start=1): print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group())) for groupNum in range(0, len(match.groups())): groupNum = groupNum + 1 print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum))) # Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and 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 Python, please visit: https://docs.python.org/3/library/re.html