14,921,072 members
See more: , +
<pre><pre>Required Regular expression Validation Start two Fixed character and then after Numeric fixed Character.

Example:

- Length : additional 20 numbers. - Example : ABcD3456789012345678cc If "AB" then 20 characters. AB+20 AlphaNumeric

- Length : additional 14 numbers. - Example : XY0123456789012 If "XY" then 14 numbers. XY+12 numbers

(?:AB[\da-zA-Z]{20}|XY\d{14})\$ i need in this expression add one condition if string not start with AB or XY then it's allow 0 to 100 character.

What I have tried:

Regex Validation Start two Fixed character and then after Numeric fixed Character
Posted
Updated 10-Sep-20 5:38am
v3

## Solution 1

Try:
^(AB\d{20})|(XY\d{14})\$

But ... your second example doesn't match the initial description of "additional 14 digits"

yes, you are correct mistake i have written wrong information,Thanks for Answer.
it's for workforme.
OriginalGriff 27-Aug-20 9:03am

You're welcome!

(?:AB[\da-zA-Z]{25}|CC\d{14})\$ i need in this expression add one condition if string not start with AB or CC then it's allow 0 to 100 character.
OriginalGriff 10-Sep-20 12:05pm

And?
What have you tried?
Where are you stuck?

## Solution 2

Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx: Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This site also show the Regex in a nice graph but can't test what match the RegEx: Regexper[^]

(?:AB[\da-zA-Z]{25}|CC\d{14})\$ i need in this expression add one condition if string not start with AB or CC then it's allow 0 to 100 character.