cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a 0 (Zero) to a O

Roland_Ohlson1
Champ in-the-making
Champ in-the-making

Hi,

Having problems with a text field that contains both 0 (Zero) and the letter O

The OCR engine founds the value but thinks the letter O is a 0 (zero), the value is a mix of numeric and uppercase letters with a fixed format 12AB123 when I have a value like 14VO337 I get the result 14V0337.

Can I use Keyword lookup and replace to look for a zero in place three and four and replace that zero with a O? If yes how do I do that?

Best regards
Roland

(Using OnBase 13.0.2)

4 REPLIES 4

Roland_Ohlson1
Champ in-the-making
Champ in-the-making

It’s funny, as soon you place your question on the community the answer hits you like lightning 🙂

I think i solved it. In the Keyword and Replace I compare the result and if I found a zero I replace it with a O.

Did it like this.

It look like it’s working. Any suggestions/comments?

/Roland

 

 

Laura_Sanders
Confirmed Champ
Confirmed Champ

Hi Roland,

Because you have a fixed format value, I agree that using Keyword Lookup and Replace would be a great tool to use to replace the zero in place three and four with a letter O.

I configured a solution that I think will work for you.  There may be other ways to configure also but I was happy with the results I got.

I used two Keyword Lookup and Replace rules.  The first rule takes care of the zero in the third place.  The second rule takes care of the zero in the fourth place.

 

Here is my configuration for the first rule:

After selecting the appropriate keyword type,

I used a Regular Expression in the Compare Value

([0-9]{2})0([A-Z][0-9]{3})

This will look for the first two numbers then a 0 then a letter then three numbers.  The parenthesis will capture the variable data.

I changed the radio button for the Replacement Value to "Replace using capture groups"

The Replacement Value I used is

[1]O[2]

This takes the variable data in the first set of parenthesis(in the compare value) then manually type the letter O then the variable data that is in the second set of parenthesis(in the compare value)

 

I configured the second rule for the same keyword type to take care of the 0 in the fourth place

Here is my Compare Value Regular Expression

([0-9]{2}[A-Z])0([0-9]{3})

I changed the radio button for the Replacement Value to "Replace using capture groups"

The Replacement Value I used is

[1]O[2]

 

I hope that this helps you!

Laura Sanders

 

Gilberto_Cortes
Star Contributor
Star Contributor

Good morning Roland,

Laura is on the right track. However, if you ever have a value where you could have two "O" as in "22OO333", you will need three Keyword Lookup and Replace rules. To understand why, Keyword Lookup and Replace will only apply the first rule to match and in order to match, the entire Compare Value must match the OCR'd value. If you expect values with double "O" in the 3rd and 4th place you will want to set up the following rules in the order in which they appear:

Compare Value: (\d{2})00(\d{3}) 'This will match if the entire value is numeric and the 3rd and 4th place values are zeros
Replacement Value: [1]OO[2]

Compare Value: (\d{2}[A-Z])0(\d{3}) 'This will match if the entire value is numeric except the 3rd position and 4th place value is a zero
Replacement Value:
[1]O[2]

Compare Value: (\d{2})0([A-Z]\d{3}) 'This will match if the entire value is numeric except the 4th position and 3rd place value is a zero
Replacement Value: [1]O[2]

Thank you for your post.

Cordially,

Gilberto Cortes

Roland_Ohlson1
Champ in-the-making
Champ in-the-making

Thank you Laura and Gilberto for your quick and accurate response.

This is what I like with OnBase and the Community, quick responses and easy to change in production.

Thanks
Roland