regexp returns wrong indices

Ralf Kuschel ralf.kuschel at yahoo.de
Mon Dec 8 15:31:54 CET 2008


Hi,
Using the regexp-expression in order to check whether
several sub-strings occur in a given string , start
and stop indices may be wrong due to shifting.

I.e:


Order

->[a1,a2]=regexp('.MEAS TRAN  DERIV y(i) WHEN y(i) <= x(i) RISE= TD=-4','/\.MEAS|TRAN|FIND|DERIV|WHEN|CROSS|RISE|FALL|TD/')


yields result:


 a2  =

    5.    9.    17.    26.    45.    51.
 a1  =

    1.    6.    13.    23.    42.    50.

This suggests  that the second sub-string which matches (TRAN) starts already at column-position 6 and ends at 9,
whereas the right result is: start at column #7 ,end at column #10.

Thank You,

Ralf Kuschel



      




More information about the users mailing list