> Le 11 déc. 2019 à 21:58, Chuck Miller via 4D_Tech <4d_tech@lists.4d.com> a > écrit : > > Hi all, > > I am finally ready to update buttons in a v17 db. The code below I think > worked in v15 but does not seem to work in v17 > $meth_txt = method text > $start_L:=1 > array long integer($start_aLp;0) > array long integer($len_aL;0) > Match regex("\r(_o_ENABLE BUTTON)(\\()(.*)(\\))(.*)\r”; > $meth_txt;$start_L;$start_aL;$len_aL) > > What is wrong with my regex command.
Hi Chuck, I can't say what's wrong, regex is hard to read for me and with 4D's double \\ it's worse… I often develop in BBEdit, then paste in 4D to avoid this - even if regex engines are a bit different. I'd use this: $rx_t:="^_o_ENABLE BUTTON\\((\\*;)?(.*)\\)" example: $test_c:=New collection() $test_c.push("_o_ENABLE BUTTON(buttonVar)") $test_c.push("_o_ENABLE BUTTON($var)") $test_c.push("_o_ENABLE BUTTON(*;\"buttonName\")") $test_c.push("_o_ENABLE BUTTON(*;$name)") $rx_t:="^_o_ENABLE BUTTON\\((\\*;)?(.*)\\)" ARRAY LONGINT($pos_al;0) ARRAY LONGINT($len_al;0) For each ($test_t;$test_c) ASSERT(Match regex($rx_t;$test_t;1;$pos_al;$len_al)) End for each I'm not sure the starting anchor "^" suits your case, it depends on how you manage the method. For my own, I always split code in lines before, then I loop on lines. Split string command is nice for that (too bad it's slow). -- Arnaud de Montard ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************