How to write repeating Regex pattern in JavaScript -
how write regex following pattern in javascript:
1|dc35_custom|3;od;czy;gl|2;ob;bnp;mt|4;sd;abc;mt|5;ih;dft;fr|6;oh;aqw;mt|7;ip;can;mt|8;op;car;mt|9;ec;smo;gl|10;do;czt;ku|
where
- the first part
1|dc35_custom|fixed. - the second part onwards, pattern repeats 9 times(i.e.
3;od;czy;gl| 2;ob;bnp;mt|, on.
the 1st character in ranges 2-11 , should not repeat. example 3 appears in first pattern, should not appear again.
i'm making lot of assumptions this, here's crack @ it:
1\|dc35_custom\|(([2-9]|10|11);[a-z]{2};[a-z]{3};[a-z]{2}\|){9} how works
1\|dc35_custom\|literal text, escaping vertical bar operators([2-9]|10|11)match number 2 11.[a-z]{2}match 2 lowercase letters[a-z]{3}match 3 uppercase letters[a-z]{2}match 2 uppercase letters{9}looks 9 consecutive matches of entire sequence enclosed in parentheses
it not, amadan points out, check uniqueness, because that's bit beyond regex for.
Comments
Post a Comment