I have a list of (variable) names that I want to delete from a longer list of names using ustrregexra("long_list","short_list-regex",""), i.e. I'd like to search for all matches of short_list in long_list and replace them with nothing using ustrregexra().
My problem is that I want to use the `$`-Operator to avoid matches with names that have additional suffixes.
Here's an example:
Suppose I have a global containing "te_m te_m_uq te_m_f te_m_uq_f" from which I'd like to delete te_m & te_m_uq, but keep te_m_f & te_m_uq_f - in my actual problem, both lists are quite a bit longer
The result should eventually be stored into a global
My problem is that I want to use the `$`-Operator to avoid matches with names that have additional suffixes.
Here's an example:
Suppose I have a global containing "te_m te_m_uq te_m_f te_m_uq_f" from which I'd like to delete te_m & te_m_uq, but keep te_m_f & te_m_uq_f - in my actual problem, both lists are quite a bit longer
Code:
glo long_list "te_m te_m_uq te_m_f te_m_uq_f" . dis ustrregexra("${long_list}","(te_m|te_m_uq)","X") // not what I want -> leave 2 & 4 unchanged X X_uq X_f X_uq_f . dis ustrregexra("${long_list}","(te_m$|te_m_uq$)","X") // does not change te_m & te_m_uq te_m te_m_uq te_m_f te_m_uq_f . dis ustrregexra("${long_list}","(te_m|te_m_uq)$","X") // does not change te_m & te_m_uq te_m te_m_uq te_m_f te_m_uq_f
Comment