Script Regular Expresison

  • 14 Views
  • Last Post 4 days ago
Anthony Dwyer posted this 6 days ago

Hey Team,

I have brain damage with a script containing a regular expression that I just cant seem to see what the issue is.

I am targeting the "Document Number" in the below text example form my OCR extraction.  I note thee is a SPACE before the 2738116 that I am targeting.

SERVICE TAX INVOICE

Document No.: 2738116

Document Date: 27/11/2024

Invoice To: 10541

This is my expression

TargetINV_NO = ".*Document No.: [ \.:]*\s([0-9]{7})"

Any suggestions on where I'm going wrong?

I deally I would use this one, which works when I use the RegEx tester but how can I adapt for VBS?

Document No\.\:\s*(\d+)

 

luca.scarpati posted this 4 days ago

Hi Anthony,

 

it all depends on your script (independent from Scanshare) and what functions you use to check the RegExp (for example if it checks some group or something else...)...furthermore your expression is wrong, it never reads that data with this RegExp .*Document No.: [ \.:]*\s([0-9]{7}) because there are many white spaces mandatory that we think not exist into your "document number"

 

In general into some common script that you find into Samples e Materials categories you can try to use this:

TargetINV_NO = (.*Document No[\s\.:]*)([0-9]{7})

 

Best regards,

Luca

Close