-3

I have to write regular expression in informatica data quality for 16 digit ID which should follow below set of validation. ID Must have 16 characters and follow below rules-

  1. First 6 must be alphabetic characters
  2. Position 7 & 8 are numeric digits
  3. Position 9 alphabetic character
  4. Position 10 &11 are numeric digits
  5. Position 12 alphabetic character
  6. Position 13-15 are numeric digits
  7. Position 16 alphabetic character

I have tried with many ways , not working as expected.Can anyone please help me here.

Yash
  • 39
  • 1
  • 7

1 Answers1

1

You may try:

^[A-Za-z]{6}[0-9]{2}[A-Za-z][0-9]{2}[A-Za-z][0-9]{3}[A-Za-z]$

Note that if the alphabetic characters would be only exlcusively uppercase or lowercase, then you may replace the chracter class [A-Za-z] with either just [A-Z] or [a-z].

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
  • Unless you are matching a single "statement", \b might be better as bounds (rather than ^ and $) – TonyR Aug 01 '20 at 16:51
  • I understand the Informatica regex engine uses [Perl-compatible syntax](https://docs.informatica.com/data-integration/data-services/10-2/transformation-language-reference/functions/reg_match.html). If so, subroutines could be used here: `^([A-Za-z]){6}([0-9]){2}(?1)(?2){2}(?1)(?2){3}(?1)$`. – Cary Swoveland Aug 01 '20 at 23:36