Match Text - Returning Too Many Matches

Hi Michael,

To demonstrate the power of Regex, here’s a variant which groups the synonymous patterns and outputs a preferred term regardless of which synonym is found. In this case that’s the short alpha form (ft, cm etc).

20230623_Match_Text_Too_Many_Results_Question_01a_J2.gh (25.8 KB)

You can extend this by adding synonyms separated by vertical bars (these being the regex for alternatives). The first synonym on each row will be the preferred term. The sets of patterns have brackets added and word delimiters, this time using a lookahead and a lookbehind syntax (which makes the intent clearer to a regex practitioner).

Regards
Jeremy

1 Like