Jump to content

Is there a way to come up with a regular expression for this?

I am trying to create a question on google forms with the following conditions but having a hard time figuring out how to create a regular expression for this

 

What is your member ID?

 

- Must be an 8 digit number
- cannot be repeating numbers like 00000000 or 11111111 etc
- cannot be 12345678

 

Is there a way to come up with a regular expression to achieve this?

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, emosun said:

Cannot be sequential or commonly used

Can you please clarify? does this mean its not possible in regex?

Link to comment
Share on other sites

Link to post
Share on other sites

It's definitely possible. There's probably a better way but this works:

((?!12345678)(?![0]{7})(?![1]{7})(?![2]{7})(?![3]{7})(?![4]{7})(?![5]{7})(?![6]{7})(?![7]{7})(?![8]{7})(?![9]{7})^(\d)\w{7}\b)

 

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

58 minutes ago, fame_crane said:

I am trying to create a question on google forms with the following conditions but having a hard time figuring out how to create a regular expression for this

 

What is your member ID?

 

- Must be an 8 digit number
- cannot be repeating numbers like 00000000 or 11111111 etc
- cannot be 12345678

 

Is there a way to come up with a regular expression to achieve this?

 

You have an underdefine logic here. Why cant the ID be 12345678 ? it mean you actually have a real known format.

Is 87654321 valid

is 12345432 valid

 

Right now you first member goes from 00000001 to 11111110 then jumps 1 to 11111112 then it's valid up to 12345677 and again jump 1 to 12345679.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×