andgineer / TRegExpr

Regular expressions (regex), pascal.
https://regex.sorokin.engineer/en/latest/
MIT License
174 stars 62 forks source link

wrong 'not fixed op' demo message #305

Closed Alexey-T closed 1 year ago

Alexey-T commented 1 year ago
    reg.Compile;
    if reg.IsFixedLength(op, i) then
      ListDump.Items.Add('Fixed length: '+IntToStr(i))
    else
      ListDump.Items.Add('Not fixed op: '+reg.DumpOp(op)); 

for

OP_BOL OP_EOL OP_EOL2 OP_BOLML OP_EOLML OP_CONTINUE_POS

we get 'not fixed op' string in demo window. it means 'match has not fixed length'.

Screenshot from 2023-08-16 10-56-10

it's wrong. theese opcodes are fixed.

Alexey-T commented 1 year ago

@User4martin

SUBJ causes fail on this regex:

Screenshot from 2023-08-16 21-19-34

let's fix it in IsFixedLength method: find

      OP_COMMENT,
      OP_BOUND,
      OP_NOTBOUND

and add here:

      OP_COMMENT,
      OP_BOUND,
      OP_NOTBOUND,
      OP_BOL,
      OP_BOLML,
      OP_EOL,
      OP_EOL2,
      OP_EOLML,
      OP_CONTINUE_POS:
        Continue; 

Pls add this fix to your PR

User4martin commented 1 year ago

done

Alexey-T commented 1 year ago

solved (in PR).