Fetch data between curly braces with plain text

Published on Tue Mar 01 2022

This regex fetch only the data between content in curly braces (first occurrence, use preg_match_all in php, for all occurrences). This is useful for bad JSON files with wrong format or text between.

Additional matching regexes for
Fetch data between curly braces with plain text

Fetch data between curly braces with plain text

This regex fetch only the data between content in curly braces (first occurrence, use preg_match_all in php, for all occurrences). This is useful for bad JSON files with wrong format or text between.

Match nth occurence of pattern

Match nth occurence of the patterns in the inner parenthesis. Put nth that you want to match in the curly braces (here, {3}).

Match nth occurence of expression

Change the number in curly braces (3 in this example) to match for the nth occurence of the expression in the two inner parenthesis

Extract elevation from GPX

Matches everything except content between <ele> and </ele>

background-image URL

regex to fetch the URL of the background-image CSS-Propertie

Anything sorounded by " "

Match anything inside double quote string and set the first capture group with the content

Match_Between_Nth_And_Nth+1_Occurence_Of_Character_Pattern

This regular expression is designed to work with character-delimited strings, and provides a means to specify the index of delimiter occurrence at which content is extracted.

question regarding "split" like regex group

dear all, i am a regex beginner, so please be gentle :) we have lines of log contents delimited by a pipe char. is it possible to fetch the content between the 5th and the 6th delimiter, ignoring the values in between? example log line: 2014-05-21_06:50:59|10.128.3.20|-|-|-|GET|/home.html|-|6 I'd like to do something like result = line.split('|')[6]. unfortunatelly I can't write code but only a regex selector. help is highly appreciated.

Web wikilinks

[[plain wikilinks]] <e>[[</e>first tag]] <e dsss>[[</e>meta on first tag]] <e dsss>[[</e><div>first tag + meta + container</div>]] <e dsss>[[</e><div>first tag + meta + container + third tag</div><div>]]</div> <e dsss>[[</e>forgot a bracket <e dsss>[[</e>bracket containers<e>]]</e> all is well

Save everything between <code>...</code> brackets

This is what I created to paste in web page source code and regex to extract content between whichever HTML brackets that I choose.. In this case, it's the <code> HTML brackets.