MariaDB Regex Substring Extraction

via Freelancer ·

Budget / Salary$30–250
TypeFreelance project
LocationRemote
Posted57 minutes ago
I have a table

ID (varchar) | FieldA (text)

where ID is the primary key, and FieldA is a text field.

FieldA contains long text blocks. I want to search this field for substrings (there can be several of them in a record) in the format "\qty{...}{...}" or "\qtym{...}{...}", where "..." denotes text strings, e.g. "\qty{3}{\gram}" or "\qty{3}{\text{cars}}" or "\qtym{\(x\)}{\kilo\gram}". (This is LaTeX code for the SIUnitsx package, where qtym is a user-defined macro that handles non-numbers like variables \(x\).)

To proof the text, I would like to search and extract all such substrings and form a new table, including the record ID, e.g.

2026-10-08-01 | \qty{3}{\gram}
2026-10-08-11 | \qty{3}{\text{cars}}
2026-05-13-21 | \qtym{\(x\)}{\kilo\gram}

or in the separated format

2026-10-08-01 | qty | 3 | \gram
2026-10-08-11 | qty | 3 | \text{cars}
2026-05-13-21 | qtym | \(x\) | \kilo\gram
php data processing sql mysql mariadb database development regular expressions data extraction
Apply on Freelancer →

Project sourced from Freelancer.com. Applications happen directly on the original platform — we never collect your data.