我目前正在寻找验证以下要求的正则表达式:
示例:
12345678: true
123adafa45678: true
123ab456: false (needs atleast 8 digits, now only 6)
ab12345a678: true
ab123456789afgb2459a2: false (more then 20 characters)
我尝试了几件事,但如果我使用类似的东西:
(\D*\d\D*){8,}
然后它可以工作,但它不符合最后一个要求(最多20个字符)。
答案 0 :(得分:2)
使用8位数的前瞻:
struct aDB_RECORD{
int aDB_oID;
int aDB_oTYPE;
string aDB_oCCY;
string aDB_oDATE;
};
aDB_RECORD anArrayOfSTRUCTs[];
int anArrayStackPTR = 0
...
anArrayOfSTRUCTs[anArrayStackPTR].aDB_oID = aDecodedOrderID; // 123556
anArrayOfSTRUCTs[anArrayStackPTR].aDB_oTYPE = aDecodedOrderTYPE; // 0
anArrayOfSTRUCTs[anArrayStackPTR].aDB_oCCY = aDecodedOrderCCY; // "EURUSD"
anArrayOfSTRUCTs[anArrayStackPTR].aDB_oDATE = aDecodedOrderDATE; // "2016-12-03 03:00:00"
请参阅live demo。