Rogerio Kioshi wrote:I need to validade if a string has 8 characters, at least 1 letter, 1 number and 1 special character. How to write this rule using Regex?
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
naved momin wrote:
Rogerio Kioshi wrote:I need to validade if a string has 8 characters, at least 1 letter, 1 number and 1 special character. How to write this rule using Regex?
all you need is this regex
but remember from now one , here we are to help you not to provide ready made solutions so from now first show us what you have tried so far then any one would love to solve your problem . k. have a good day bye, put as much special characters you want in the last square bracket.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
Michael Parmeley wrote:You could also take advantage of all the special characters being 33-47 decimal (inclusive) in the ascii table.
Adrian Burkett wrote:
Michael Parmeley wrote:You could also take advantage of all the special characters being 33-47 decimal (inclusive) in the ascii table.
Are you sure ? Without even looking at an ascii table I can tell you it's not true. 33 - 47 covers a range of 15 characters, but Rogerio has 22 characters in his list of special characters.
Rogerio Kioshi wrote:Thanks for replying. Actually, I gave up using Regex and made a simple method using the following:
I think this way is better for code maintenance.
Rogerio Kioshi wrote:Thanks for replying. Actually, I gave up using Regex and made a simple method using the following:
I think this way is better for code maintenance.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Don't get me started about those stupid light bulbs. |