Add functionality to extract groups from a Regex match in a single function

Say I have a complex barcode which need to be validated and then parsed, I could do this using a standard regex match string which describes groupings. Tulip at present seems not be able to either extract all matches (i.e. “global match”) or match groups in particular - unless there is an undocumented trick.

Example input string:

A:4711;B:;C:abcd;D:efghi;E:15548;F:

Example regex:

/^A:([^;:]+)?;B:([^;:]+)?;C:([^;:]+)?;D:([^;:]+)?;E:([^;:]+)?;F:([^;:]+)?$/g

I would like to a) validate that the incoming string matches the expected format and has all the expected keywords, and then b) extract the values of each so I can properly reference them in an app without the need to go via a custom widget or other tinkering.

As a workaround I am able to achieve the expected outcome by chaining a Regex match for each of the keywords separately, storing them in an array and then extracting the first element of the resulting array in order to store it in the actual object key/value pair.

Hi @sebme,

Thank you for the feedback - just to make sure that I understand your ask, you’d like to provide an input string then utilize regex to make sure the string is in that specific format and have it return the values of the string into a list?

Sincerely,

Jake

Jake

Yes, basically not only match but also return the matching groups as an array. So validation and interpretation in one go as supported by standard regex.