Hello, hope one of you can see what I'm struggling with here.....;
I'm trying to extract value from a Zone OCR, using script sample from this link:
The problem I have is first of all, I'm not experienced in scripting, but normally I understand enough to edit simple examples. This time I was unable to...
The problem I have when using the script is that it will find several matches from my RegEx in the zone, but I should have the value from the first hit. I get the value from the last hit instead, and I don't understand what to change in the script to make it only get the first match.
This is the script (so I have only made some minor changes):
'###Variable definition area
'The user need to define the name of the metadata that is used as input sSearch = Metadata.Values("metadata")
sSearch = Metadata.Values("OCR_ZONE01")
'The user need to define the regular expression to be used on the metadata sPattern(1) = expression
sPattern(1) = "\d\d[\,\.]\d\d[\,\.]\d\d"
FOR I = 1 TO 1
call Application.Log(20, "Pattern to search: " & sPattern(I))
call TestRegExp(sPattern(I), sSearch)
Sub TestRegExp(sPattern, sSearch)
' Do the regular expression match
Dim oRE, oMatches
Set oRE = New RegExp
oRE.Global = True
oRE.IgnoreCase = True
oRE.Pattern = sPattern
Set oMatches = oRE.Execute(sSearch)
For Each oMatch In oMatches
call Application.Log(20, "Find part: " & oMatch.Value)
Anyone have an idea?
Thanks in advance
Best regards, Anders Hantveit
Senior System Engineer, MCS, PRS and IMS ## Konica Minolta Business Solutions Norway AS