I would like to create a regex for the ISIN codes. It should spot first the ISIN codes and then check if both, source and target, have identical ISIN codes. If not, I would like to receive an error message.
There is a similar regex for Studio:
Source: (\b[A-Z]{2}\d{10}\b)
Target: $1
And I have tried with this one for XBench:
Source: “[A-Z]{2,}[0-9]{10,}”
PowerSearch ON
Regular Exp
Which shows all the ISIN codes, but don’t know what to put in the target field. It does not work with:
Target: -"[A-Z]{2,}[0-9]{10,}"
Any clues?
First, let me mention that the canned Alphanumeric Mismatch canned text should report mismatches or omissions of ISIN codes because they are just alphanumeric sequences.
The Alphanumeric check will also catch issues if there are more than one ISIN code in the same segment.
That said, you can also check for ISIN codes with regex. Note: ISIN codes are 2 letters followed by 9 alphanumeric characters + 1 digit.
What you need to do is the following:
- Write a regex to match the ISIN code in source. This would be
<[A-Z]{2}[A-Z0-9]{9}[0-9]>
(the angle brackets are word delimiters in Xbench regex).
- Capture the resolved value of the regex in source into a variable. This would be
(<[A-Z]{2}[A-Z0-9]{9}[0-9]>)=1
to capture the resolved value into variable 1
- Use in target the PowerSearch expression “NOT captured variable”. The NOT is a minus sign in PowerSearch. The captured variable is
@1
in Xbench Regex. So target would be: -@1
.
Summarizing, it would be:
- Source:
(<[A-Z]{2}[A-Z0-9]{9}[0-9]>)=1
- Target:
-@1
- Regex:
Enabled
- PowerSearch:
Enabled
- Case sensitive:
Enabled
Please note that this supports one ISIN per segment. If you have to support several ISINs in the same segment, you need to write separate checklist items (one checklist item to support the case of 2 ISINs in the same segment, another checklist item to support the case of 3 ISINs in the same segment, etc).
So although it can be done with regex, the canned Alphanumeric Mismatch QA check is more convenient.
Thanks you so much for your help. Indeed and after your explanation, the Alphanumeric Mismatch QA check might be the best and easiest option, but I’ll try and check the regex too