Flagrant Badassery

A JavaScript and regular expression centric blog

All Posts Tagged With: "recursion"

Matching Innermost HTML Elements

On a regular expression forum I visit every once in awhile, a user asked how he could match all innermost tables within HTML source code. In other words, he wanted to match all tables which did not contain other tables. The regex should match <table>…</table>, but should only match the inner table within <table>…<table>…</table>…</table>. This […]

Read More

Regex Recursion (Matching Nested Constructs)

On a regular expression advice forum I visit every once in a while, some dude was trying to scrape BibTeX entries from Web pages using JavaScript (from within a Firefox extension). A single BibTeX entry looks roughly like this: @resourceType{ field1 = value, field2 = "value in quotation marks", field3 = "value in quotation marks, […]

Read More