how do i write a regular expression to validate user input to ensure that the user input contains 1 digit, a space and any number of letters.

Recommended Answers

Although it often sounds like a regex is your solution, it's not always the case. Simply counting the required characters/digits is much simpler.

Jump to Post

All 3 Replies

Although it often sounds like a regex is your solution, it's not always the case. Simply counting the required characters/digits is much simpler.

how do i that? i'm lost and have no where to start

You can use a loop, so you check each letter and keep administration of what passes are valid, invalid characters. You can use strpos to check.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.