prxmatch issue?

Super Contributor
Posts: 398

prxmatch issue?

[ Edited ]



I have the following prxmatch codes. 


else if prxmatch("m/(?=.*?if_audiol)/i", &var) > 0 then found=18;

else if prxmatch("m/(?=.*?if_audiol_dt)/i", &var) > 0 then found=19;

else if prxmatch("m/(?=.*?if_audiol_res)/i", &var) > 0 then found=20;

else if prxmatch("m/(?=.*?if_audiol_res_sp)/i", &var) > 0 then found=21;

else if prxmatch("m/(?=.*?mhh_exp_ustrv)/i", &var) > 0 then found=223;

else if prxmatch("m/(?=.*?mhh_exp_ustrv_en)/i", &var) > 0 then found=224;

else if prxmatch("m/(?=.*?mhh_exp_ustrv_here)(?=.*?yes)/i", &var) > 0 then found=225;

else found=0;




I found out all of the follow rows have been assigned to 18 and 223, how to differentiate the following conditions with the correct numbers:


if_audiol_1                         18

if_audiol_2                         18

if_audiol_dt_1                      19

if_audiol_dt_2                      19

if_audiol_dt_3                      19

if_audiol_res_1                     20

if_audiol_res_2                     20

if_audiol_res_3                     20

if_audiol_res_4                     20

if_audiol_res_sp_1                  21

if_audiol_res_sp_2                  21

mhh_exp_ustrv                       223

mhh_exp_ustrv_en1                   224

mhh_exp_ustrv_here1_yes             225






Super User
Posts: 23,771

Re: prxmatch issue?

Change the order of your IF/ELSE IF to have the most detailed first down to the most generic. Your current system has it backwards.

Respected Advisor
Posts: 4,736

Re: prxmatch issue?

[ Edited ]


Should your strings like if_audiol be "words" and not just sub-strings then you could also use the \b syntax to avoid matches with sub-strings and not whole words. ->  \bif_audiol\b

Posts: 2,370

Re: prxmatch issue?

I still think you do not need to read ahead. Your RegEx seems to be needlessly complex.

Ask a Question
Discussion stats
  • 3 replies
  • 1 like
  • 4 in conversation