简体   繁体   中英

Regular expression Javascript match letters except one

I am trying to improve my regular expression in order to not match this string when it has a D in it:

www.google.com/.../DE69619938D1?cl=e

My regex :

(DE)([0-9]{1,12})((?:[ABCUT][0-9]?)?)
  1. I want to match when "D1" is missing: that's why I put a ? after this group. (working)
  2. I want to match when the letter is ABCU or T. (working)
  3. But when it is a D after the numbers I don't want to match the string and I don't know how to make this without losing the first rule.

尝试这个

(DE)([0-9]{1,12})(?:(?:[ABCUT][0-9]?)|\?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM