[SOLVED] Is there a length limit for $Syntax?

Author: eitan@amital.co.il (hareitan)

It seems that $Syntax has a limit of 395 chars. 

$1 = "22112-1.MSG EM-92582-1.MSG EM-92584-1.MSG EM-92588-1.MSG EM-92590-1.MSG EM-92587-1.MSG EM-92592-1.MSG EM-92589-1.MSG EM-92594-1.MSG EM-92591-1.MSG EM-92593-1.MSG EM-92596-1.MSG EM-92600-1.PDF EM-92598-1.MSG EM-92597-1.MSG EM-92602-1.MSG MNO-15733-1.PDF CUS-69000-1.TIF CUS-69002-1.PDF CUS-69001-1.PDF CUS-69003-1.PDF CUS-69049-1.TIF CUS-69050-1.TIF CUS-69051-1.PDF CUS-69053-1.TIF CUS-69733-1.PDF" $Length($1) ==> 396 $1 = $Syntax("*CUS*") ==> 0

 But

$1 = "2112-1.MSG EM-92582-1.MSG EM-92584-1.MSG EM-92588-1.MSG EM-92590-1.MSG EM-92587-1.MSG EM-92592-1.MSG EM-92589-1.MSG EM-92594-1.MSG EM-92591-1.MSG EM-92593-1.MSG EM-92596-1.MSG EM-92600-1.PDF EM-92598-1.MSG EM-92597-1.MSG EM-92602-1.MSG MNO-15733-1.PDF CUS-69000-1.TIF CUS-69002-1.PDF CUS-69001-1.PDF CUS-69003-1.PDF CUS-69049-1.TIF CUS-69050-1.TIF CUS-69051-1.PDF CUS-69053-1.TIF CUS-69733-1.PDF" $Length($1) ==> 395 $1 = $Syntax("*CUS*") ==> 1

track=9.6.05.02 config=X502 0725_2 platform=WN2 version=9.6.05

3 Comments

  1. 396 is an odd length, but I think you'll find that in the first string, the first CUS pattern happens at characters 254-256.  In the second, the first cus pattern happens at 253-255. I suspect the limit is that it only checks the first 255 characters.  To test this, take the first string and remove a character from the end, if it still fails, I'm right.  I can't see any documented length limit.  The only inline solution I can see would be something like.    for v_int = 1 to $length($1) step 100 if($1[v_int:200] = $syntax("*CUS*")) v_bool = <true> break endif endfor   Which leaves overlaps so the pattern isn't likely to be split across chunks (unless it's > 100 chars in length). 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. The limit Iain has discovered is actually documented: see description of $syntax:

    "Note: In a logical expression, the pattern specified by the syntax string must occur within the first 256 characters of the string with which it is being compared." Okay, the doc seems to be off by one character (255 instead of 256). Hope this helps. Kind regards, Daniel Iseli Uniface Technical Support


    Author: diseli (daniel.iseli@uniface.com)
  3. The documentation has been updated since the O.P.'s version (and mine) 9.6.05 has not got that note. Still good to know it's now documented. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)