Giray Posted June 11, 2022 Posted June 11, 2022 I need to write a super simple regex. I was going to post the ask on Reddit but they ask what flavor of Regex we're using: PCRE, Python, Javascript, Notepad++, Sublime, Google Sheets, etc Thanks
Giray Posted June 11, 2022 Author Posted June 11, 2022 in case anyone wants to try their hand, it's just: Any uppercase letters (no limit on # of characters) followed by exactly 4 digits No digits allowed before the the letters No letters allowed after the four digits No special characters allowed So good: JOHN1960 JEFF5120 JIM2345 But bad: 12JOHN1960 JOHN 1960 JOHN19607 JOHN1960T All I really need is the 'flavor'. No need to really rack your brains over the expression. Just posted in case we have a wiz who can bang it out in their sleep. Otherwise will post on the regex subreddit. Thanks all. SeNioR- 1
teraßyte Posted June 11, 2022 Posted June 11, 2022 (edited) PCRE flavor. As for the regex itself, try this one: /^[A-Z]+[0-9]{4}$/gm Edited June 11, 2022 by teraßyte SeNioR- 1
Jim M Posted June 11, 2022 Posted June 11, 2022 Thanks for posting! Unfortunately, this issue is beyond the scope of our technical support. 👩💻 Our technical support is happy to help you with the Invision Community platform, but we're unable to help with things like server management, theme questions and modifications. I've moved this to our Community Support area where other Invision Community owners will see it and help where they can. Giray 1
Giray Posted June 11, 2022 Author Posted June 11, 2022 1 minute ago, Jim M said: I've moved this to our Community Support area where other Invision Community owners will see it and help where they can. My bad, put it in the wrong place. @Terabyte thanks. Almost perfect. For some reason, the [A-Z] is still allowing for lowercase letters to slip through? Also, in regex101.com I can't seem to put the first / and the /gm. It asks for a \ escape. But without it works fine, I just have to force the uppercase 😉
Giray Posted June 11, 2022 Author Posted June 11, 2022 DUH. Figured it out. Fantastic, works!! Thank you.
Recommended Posts