Today, I was working with a MySQL database that contained a column of text that I wanted to parse out into multiple other columns so I could query on them. The first thing that came to mind was why not use regular expressions to extract out the needed bits from the column, but unfortunately, MySQL does not support this use of regular expressions nor regular expression matching at all on InnoDB tables (which is what this was). I was able to accomplish this task using the following SQL:

To extract the first instance of a given piece of text between string start and string end in string content:

For example, start=”www.”, end=”.com”, content=”www.facebook.com links to www.google.com” and I want to select out “facebook”: