Barcode split with regex

Barcode split with regex

Postby mirodonie.george » Wed Aug 01, 2012 2:11 am

Hello,

I have a barcode that I have to split in half. I have the barcode splitted with some variables like the example below:

1.voj123456_12345
2.132465423135456_12345
3.1123_12345

Here is where I am so far:

1. a. voj123456_
b. _12345
2. a. 132465423135456_
b. _12345
3. a. 1123_
b. _12345

I use a script with some regex builder like below:

Code: Select all
  KfxBorderou = RegexSearch(KfxBorderou, "\w{2,11}([_]+)")
      if KfxBorderou = "" Then
         KfxBorderou = "eroare la ocr"
       end if

 
  if KfxDocumentID = "" then
      KfxDocumentID = "nerecunoscut"
   else
      KfxDocumentID = RegexSearch(KfxBorderou, "([_]+)\w{2,11}")
      if KfxDocumentID = "" Then
         KfxDocumentID = "eroare la ocr"
      end if
   End if


I must say that I don't know to trim the "_" space
Thank You
mirodonie.george
Participant
 
Posts: 9
Joined: Tue Mar 27, 2012 1:10 am

Re: Barcode split with regex

Postby DavidCrewe » Mon Aug 06, 2012 1:01 am

Hi,

If you are writing this in SBL then a simple loop can be used:

dim i as integer
dim tmpSTR as string
for i=1 to len(KfxBorderou)
if mid(KfxBorderou,i,1)<>"_" then tmpSTR=tmpSTR & mid(KfxBorderou,i,i)
next i
KfxBorderou=tmpSTR

If you are writing in something more like VB, then it's even easier:

KfxBorderou=Replace(KfxBorderou,"_","")

Hope that helps.
David Crewe

Check out our set of custom add-ons for Kofax Capture - www.DavidCrewe.com/products.html
DavidCrewe
Participant
 
Posts: 232
Joined: Tue Apr 29, 2008 2:24 am
Location: UK


Return to Release Scripts General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron