Click here to Skip to main content
15,867,860 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need check given input alphanumerical and numeric contentions digits length max 7 characters

String start with alpha or number
string end with alpha or number

ex: abc123456bcvdgd
Ex: 1254673abchetet123
Ex : abxchhfh1234423

kindly help on this

What I have tried:

I have tried my level best i couldn't found any thing
Posted
Updated 23-Aug-17 9:31am
Comments
PIEBALDconsult 22-Aug-17 21:44pm    
^(([a-zA-Z]{1,})|((?<!\d)\d{1,7}(?!\d))){1,}$
Patrice T 22-Aug-17 22:02pm    
Same question was already asked today by an help vampire
Regular expressing for the following string[^]
Answers will be the same.
Patrice T 22-Aug-17 22:12pm    
"I have tried my level best i couldn't found any thing"
Show your work !

Try even simpler than the "answer" the help vampire posted:
^[\da-zA-Z]{0,7}$

If you are allowed underlines then it's trivial:
^\w{0,7}$
But do notice that your examples all fail...
 
Share this answer
 
Quote:
kindly help on this

"Helping you" means helping to find what you did wrong in work you have done, but you show no work!

Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900