I am using zone ocr to capture a value example G123456 A I need to remove the blank space between the 6 and the A.
I have tried a number of variations such as \w[0-9]+ this returns G123456 any help would be appreciated.
I am using zone ocr to capture a value example G123456 A I need to remove the blank space between the 6 and the A.
I have tried a number of variations such as \w[0-9]+ this returns G123456 any help would be appreciated.
You could use the following expression: (\w+)\s([A-Z|a-z])*
To clarify the final piece ([A-Z|a-z])*:
this is looking for upper [A-Z]
or |
lowercase [a-z] letters, but not digits.
It's also looking for zero or more matches (because of the *).
Which means that if 1 is in the position of the A in your example, it won't return the digit, but it will still return the rest of the value. If you're looking to clean it up a little, you can remove the |a-z, if you're not expecting the end character to be lowercase.
Hi John,
If you don't know where spaces are to appear, try using Pattern Matching activivity (assuming you're dealing with workflows) as follows:
In this case, you should look to use a \s to indicate that you're expecting a "white space character". So the full regular expression would be (\w+)\s(\w). This removes the space character in your example, but it may require additional tweaks to fit your exact case.
Please respond if you have any questions or mark this response as an approved answer if it answered your question!
Hi Rob:
I have one other problem, G123456 A sometimes the A is a number 1. If it is 1 I would like to disgard the 1. If it is A keep the A. I thought with the \w that would be the case. Any suggestions?
You could use the following expression: (\w+)\s([A-Z|a-z])*
To clarify the final piece ([A-Z|a-z])*:
this is looking for upper [A-Z]
or |
lowercase [a-z] letters, but not digits.
It's also looking for zero or more matches (because of the *).
Which means that if 1 is in the position of the A in your example, it won't return the digit, but it will still return the rest of the value. If you're looking to clean it up a little, you can remove the |a-z, if you're not expecting the end character to be lowercase.
Thanks Rob That did the trick