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

/
/
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

$re = '/\s*\/\/.*/m'; $str = '{ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MAGIC EFFECT COUNTS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "MagicEffectsCount": { "Magic": [ [ 1, 80 ], [ 2, 28 ], [ 3, 12 ] ], "Rare": [ [ 2, 80 ], [ 3, 28 ], [ 4, 12 ] ], "Epic": [ [ 3, 80 ], [ 4, 28 ], [ 5, 12 ] ], "Legendary": [ [ 4, 80 ], [ 5, 28 ], [ 6, 12 ] ] }, /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ITEM RESTRICTIONS // It\'s not recommended to change any of these, but if you wanted to allow Dyrnwyn or tankards for //some reason, remove them from this list. You really shouldn\'t remove Unarmed or CAPE TEST from //this list. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "RestrictedItems" : [ "$item_tankard", "$item_tankard_odin", "Unarmed", "CAPE TEST", "Cheat sword", "$item_sword_fire", "$item_shield_iron_square" ], /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ITEM SETS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "ItemSets": [ { "Name": "Tier1EnchantMats", "Loot": [ { "Item": "EssenceMagic" }, { "Item": "DustMagic" }, { "Item": "ReagentMagic" } ] }, { "Name": "Tier2EnchantMats", "Loot": [ { "Item": "EssenceRare" }, { "Item": "DustRare" }, { "Item": "ReagentRare" } ] }, { "Name": "Tier3EnchantMats", "Loot": [ { "Item": "EssenceEpic" }, { "Item": "DustEpic" }, { "Item": "ReagentEpic" } ] }, { "Name": "Tier4EnchantMats", "Loot": [ { "Item": "EssenceLegendary" }, { "Item": "DustLegendary" }, { "Item": "ReagentLegendary" } ] }, { "Name": "Tier0Weapons", "Loot": [ { "Item": "Club", "Rarity": [ 95, 5, 0, 0 ] }, { "Item": "AxeStone", "Rarity": [ 95, 5, 0, 0 ] }, { "Item": "Torch", "Rarity": [ 95, 5, 0, 0 ] } ] }, { "Name": "Tier0Tools", "Loot": [ { "Item": "Hammer", "Rarity": [ 95, 5, 0, 0 ] }, { "Item": "Hoe", "Rarity": [ 95, 5, 0, 0 ] } ] }, { "Name": "Tier0Armor", "Loot": [ { "Item": "ArmorRagsLegs", "Rarity": [ 95, 5, 0, 0 ] }, { "Item": "ArmorRagsChest", "Rarity": [ 95, 5, 0, 0 ] } ] }, { "Name": "Tier0Shields", "Loot": [ { "Item": "ShieldWood", "Rarity": [ 95, 5, 0, 0 ] }, { "Item": "ShieldWoodTower", "Rarity": [ 95, 5, 0, 0 ] } ] }, { "Name": "Tier0Everything", "Loot": [ { "Item": "Tier0Weapons" }, { "Item": "Tier0Tools" }, { "Item": "Tier0Armor" }, { "Item": "Tier0Shields" } ] }, { "Name": "Tier1Weapons", "Loot": [ { "Item": "AxeFlint", "Rarity": [ 99, 10, 0, 0 ] }, { "Item": "SpearFlint", "Rarity": [ 99, 10, 0, 0 ] }, { "Item": "KnifeFlint", "Rarity": [ 99, 10, 0, 0 ] }, { "Item": "Bow", "Rarity": [ 99, 10, 0, 0 ] } ] }, { "Name": "Tier1Armor", "Loot": [ { "Item": "ArmorLeatherLegs", "Rarity": [ 99, 10, 0, 0 ] }, { "Item": "ArmorLeatherChest", "Rarity": [ 99, 10, 0, 0 ] }, { "Item": "HelmetLeather", "Rarity": [ 99, 10, 0, 0 ] }, { "Item": "CapeDeerHide", "Rarity": [ 99, 10, 0, 0 ] } ] }, { "Name": "Tier1Tools", "Loot": [ { "Item": "PickaxeAntler", "Rarity": [ 99, 10, 0, 0 ] } ] }, { "Name": "Tier1Everything", "Loot": [ { "Item": "Tier1Weapons" }, { "Item": "Tier1Armor" }, { "Item": "Tier1Tools" } ] }, { "Name": "TrollArmor", "Loot": [ { "Item": "ArmorTrollLeatherLegs", "Rarity": [ 95, 15, 0, 0 ] }, { "Item": "ArmorTrollLeatherChest", "Rarity": [ 95, 15, 0, 0 ] }, { "Item": "HelmetTrollLeather", "Rarity": [ 95, 15, 0, 0 ] }, { "Item": "CapeTrollHide", "Rarity": [ 95, 15, 0, 0 ] } ] }, { "Name": "Tier2Weapons", "Loot": [ { "Item": "KnifeCopper", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "SledgeStagbreaker", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "SwordBronze", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "AxeBronze", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "MaceBronze", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "AtgeirBronze", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "SpearBronze", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "BowFineWood", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "KnifeChitin", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "SpearChitin", "Weight": 1, "Rarity": [ 95, 20, 0, 0 ] } ] }, { "Name": "Tier2Armor", "Loot": [ { "Item": "ArmorBronzeLegs", "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "ArmorBronzeChest", "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "HelmetBronze", "Rarity": [ 95, 20, 0, 0 ] } ] }, { "Name": "Tier2Shields", "Loot": [ { "Item": "ShieldBronzeBuckler", "Rarity": [ 95, 20, 0, 0 ] } ] }, { "Name": "Tier2Tools", "Loot": [ { "Item": "PickaxeBronze", "Rarity": [ 95, 20, 0, 0 ] }, { "Item": "Cultivator", "Rarity": [ 95, 20, 0, 0 ] } ] }, { "Name": "Tier2Everything", "Loot": [ { "Item": "TrollArmor" }, { "Item": "Tier2Weapons" }, { "Item": "Tier2Armor" }, { "Item": "Tier2Shields" }, { "Item": "Tier2Tools" } ] }, { "Name": "Tier3Weapons", "Loot": [ { "Item": "Battleaxe", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "SwordIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "AxeIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "SledgeIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "MaceIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "AtgeirIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "SpearElderbark", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] } ] }, { "Name": "Tier3Armor", "Loot": [ { "Item": "ArmorIronLegs", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "ArmorIronChest", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "HelmetIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] } ] }, { "Name": "Tier3Shields", "Loot": [ { "Item": "ShieldBanded", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] }, { "Item": "ShieldIronTower", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] } ] }, { "Name": "Tier3Tools", "Loot": [ { "Item": "PickaxeIron", "Weight": 1, "Rarity": [ 40, 50, 9, 1 ] } ] }, { "Name": "Tier3Everything", "Loot": [ { "Item": "Tier3Weapons" }, { "Item": "Tier3Armor" }, { "Item": "Tier3Shields" }, { "Item": "Tier3Tools" } ] }, { "Name": "Tier4Weapons", "Loot": [ { "Item": "SwordSilver", "Weight": 10, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "SpearWolfFang", "Weight": 10, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "MaceSilver", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "BowDraugrFang", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] } ] }, { "Name": "Tier4Armor", "Loot": [ { "Item": "ArmorWolfLegs", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "ArmorWolfChest", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "HelmetDrake", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "CapeWolf", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] } ] }, { "Name": "Tier4Shields", "Loot": [ { "Item": "ShieldSilver", "Weight": 5, "Rarity": [ 10, 40, 45, 15 ] }, { "Item": "ShieldSerpentscale", "Weight": 1, "Rarity": [ 10, 40, 45, 15 ] } ] }, { "Name": "Tier4Everything", "Loot": [ { "Item": "Tier4Weapons" }, { "Item": "Tier4Armor" }, { "Item": "Tier4Shields" } ] }, { "Name": "Tier5Weapons", "Loot": [ { "Item": "AtgeirBlackmetal", "Weight": 3, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "AxeBlackMetal", "Weight": 3, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "KnifeBlackMetal", "Weight": 3, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "SwordBlackmetal", "Weight": 3, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "MaceNeedle", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] } ] }, { "Name": "Tier5Armor", "Loot": [ { "Item": "ArmorPaddedGreaves", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "ArmorPaddedCuirass", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "HelmetPadded", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "CapeLinen", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "CapeLox", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] } ] }, { "Name": "Tier5Shields", "Loot": [ { "Item": "ShieldBlackmetal", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] }, { "Item": "ShieldBlackmetalTower", "Weight": 1, "Rarity": [ 0, 30, 55, 15 ] } ] }, { "Name": "Tier5Everything", "Loot": [ { "Item": "Tier5Weapons" }, { "Item": "Tier5Armor" }, { "Item": "Tier5Shields" } ] } ], "LootTables": [ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CREATURES /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Greyling //////////////////////////////////////////////////////////////////////////////////// { "Object": "Greyling", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Greydwarf //////////////////////////////////////////////////////////////////////////////////// { "Object": "Greydwarf", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Greydwarf_Elite //////////////////////////////////////////////////////////////////////////////////// { "Object": "Greydwarf_Elite", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Greydwarf_Shaman //////////////////////////////////////////////////////////////////////////////////// { "Object": "Greydwarf_Shaman", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Troll //////////////////////////////////////////////////////////////////////////////////// { "Object": "Troll", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Skeleton //////////////////////////////////////////////////////////////////////////////////// { "Object": "Skeleton", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Ghost //////////////////////////////////////////////////////////////////////////////////// { "Object": "Ghost", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // Blob //////////////////////////////////////////////////////////////////////////////////// { "Object": "Blob", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // BlobElite //////////////////////////////////////////////////////////////////////////////////// { "Object": "BlobElite", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // Draugr //////////////////////////////////////////////////////////////////////////////////// { "Object": "Draugr", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // Draugr_Elite //////////////////////////////////////////////////////////////////////////////////// { "Object": "Draugr_Elite", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // Leech //////////////////////////////////////////////////////////////////////////////////// { "Object": "Leech", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } }, // Surtling //////////////////////////////////////////////////////////////////////////////////// { "Object": "Surtling", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // Wraith //////////////////////////////////////////////////////////////////////////////////// { "Object": "Wraith", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // Wolf //////////////////////////////////////////////////////////////////////////////////// { "Object": "Wolf", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier3EnchantMats", "Weight": 1 } ] }, // Hatchling (Drake) //////////////////////////////////////////////////////////////////////////////////// { "Object": "Hatchling", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier3EnchantMats", "Weight": 1 } ] }, // StoneGolem //////////////////////////////////////////////////////////////////////////////////// { "Object": "StoneGolem", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier3EnchantMats", "Weight": 1 } ] }, // Fenring //////////////////////////////////////////////////////////////////////////////////// { "Object": "Fenring", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier3EnchantMats", "Weight": 1 } ] }, // Deathsquito //////////////////////////////////////////////////////////////////////////////////// { "Object": "Deathsquito", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier4EnchantMats", "Weight": 1 } ] }, // Lox //////////////////////////////////////////////////////////////////////////////////// { "Object": "Lox", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier4EnchantMats", "Weight": 1 } ] }, // Goblin (Fuling) //////////////////////////////////////////////////////////////////////////////////// { "Object": "Goblin", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier4EnchantMats", "Weight": 1 } ] }, // GoblinBrute (Fuling Berserker) //////////////////////////////////////////////////////////////////////////////////// { "Object": "GoblinBrute", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier4EnchantMats", "Weight": 1 } ] }, // GoblinShaman (Fuling Shaman) //////////////////////////////////////////////////////////////////////////////////// { "Object": "GoblinShaman", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier4EnchantMats", "Weight": 1 } ] }, // Serpent //////////////////////////////////////////////////////////////////////////////////// { "Object": "Serpent", "Drops": [ [0, 0], [1, 65], [2, 25], [3, 10] ], "Loot": [ { "Item": "Tier4EnchantMats", "Weight": 1 } ] }, /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BOSSES /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Eikthyr //////////////////////////////////////////////////////////////////////////////////// { "Object": "Eikthyr", "Drops": [ [1, 70], [2, 30] ], "Loot": [ { "Item": "Tier1Everything", "Weight": 2, "Rarity": [ 0, 69, 21, 3 ] }, { "Item": "SledgeStagbreaker", "Weight": 1, "Rarity": [ 0, 69, 21, 3 ] } ] }, // gd_king (The Elder) //////////////////////////////////////////////////////////////////////////////////// { "Object": "gd_king", "Drops": [ [1, 35], [2, 55], [3, 10] ], "Loot": [ { "Item": "Tier2Everything", "Weight": 1, "Rarity": [ 0, 70, 29, 5 ] } ] }, // Bonemass //////////////////////////////////////////////////////////////////////////////////// { "Object": "Bonemass", "Drops": [ [2, 60], [3, 25], [4, 15] ], "Loot": [ { "Item": "Tier3Everything", "Weight": 1, "Rarity": [ 0, 75, 34, 8 ] } ] }, // Dragon (Moder) //////////////////////////////////////////////////////////////////////////////////// { "Object": "Dragon", "Drops": [ [2, 40], [3, 40], [4, 20] ], "Loot": [ { "Item": "Tier4Everything", "Weight": 1, "Rarity": [ 0, 0, 50, 10 ] } ] }, // GoblinKing (Yagluth) //////////////////////////////////////////////////////////////////////////////////// { "Object": "GoblinKing", "Drops": [ [2, 20], [3, 60], [4, 15], [5, 5] ], "Loot": [ { "Item": "Tier5Everything", "Weight": 1, "Rarity": [ 0, 0, 70, 20 ] } ] }, /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TREASURE CHESTS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //TreasureChest_meadows //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_meadows", "Drops": [ [0, 78], [1, 20], [2, 2] ], "Loot": [ { "Item": "Tier1Everything", "Weight": 1, "Rarity": [ 97, 22, 1, 0 ] }, { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, //TreasureChest_blackforest //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_blackforest", "Drops": [ [0, 70], [1, 30] ], "Loot": [ { "Item": "Tier2Everything", "Weight": 2, "Rarity": [ 95, 24, 1, 0 ] }, { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, //TreasureChest_forestcrypt //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_forestcrypt", "Drops": [ [0, 68], [1, 20], [2, 10], [3, 2] ], "Loot": [ { "Item": "Tier2Everything", "Weight": 1, "Rarity": [ 95, 24, 1, 0 ] }, { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, //TreasureChest_fCrypt (I think this is just a copy of forestcrypt) //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_fCrypt", "Drops": [ [0, 68], [1, 20], [2, 10], [3, 2] ], "Loot": [ { "Item": "TreasureChest_forestcrypt.1" } ] }, //TreasureChest_trollcave //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_trollcave", "Drops": [ [0, 48], [1, 40], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier2Everything", "Weight": 1, "Rarity": [ 70, 29, 1, 0 ] }, { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // shipwreck_karve_chest //////////////////////////////////////////////////////////////////////////////////// { "Object": "shipwreck_karve_chest", "Drops": [ [0, 48], [1, 40], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier1Everything", "Weight": 1, "Rarity": [ 70, 29, 1, 0 ] }, { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // TreasureChest_meadows_buried //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_meadows_buried", "Drops": [ [0, 48], [1, 40], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier1Everything", "Weight": 2, "Rarity": [ 70, 25, 5, 0 ] }, { "Item": "Tier1EnchantMats", "Weight": 1 } ] }, // TreasureChest_sunkencrypt //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_sunkencrypt", "Drops": [ [0, 58], [1, 30], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier3Everything", "Weight": 1, "Rarity": [ 60, 37, 8, 0 ] }, { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // TreasureChest_swamp //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_swamp", "Drops": [ [0, 58], [1, 30], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier3Everything", "Weight": 1, "Rarity": [ 60, 37, 8, 0 ] }, { "Item": "Tier2EnchantMats", "Weight": 1 } ] }, // TreasureChest_mountains //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_mountains", "Drops": [ [0, 58], [1, 30], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier4Everything", "Weight": 1 }, { "Item": "Tier3EnchantMats", "Weight": 1 } ] }, // TreasureChest_plains_stone (Actually just forest chest again) //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_plains_stone", "Drops": [ [0, 58], [1, 30], [2, 20], [3, 2] ], "Loot": [ { "Item": "TreasureChest_heath.1", "Weight": 1 } ] }, // TreasureChest_heath //////////////////////////////////////////////////////////////////////////////////// { "Object": "TreasureChest_heath", "Drops": [ [0, 58], [1, 30], [2, 20], [3, 2] ], "Loot": [ { "Item": "Tier5Everything", "Weight": 1, "Rarity": [ 60, 37, 8, 0 ] }, { "Item": "Tier4EnchantMats", "Weight": 1 } ] } ] } '; $subst = ""; $result = preg_replace($re, $subst, $str); echo "The result of the substitution is ".$result;

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php