Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
35
rated 0 times [  36] [ 1]  / answers: 1 / hits: 16072  / 10 Years ago, mon, september 22, 2014, 12:00:00

I'm currently using this regex (/^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$/) to accept letters, numbers, spaces and underscores. I want to change it like this that it takes the combination of number and the character but not only the number.


More From » regex

 Answers
13

If i understand correctly you want to allow a string that begins with at least one letter and optionally is followed by number or underscore or space.



Try this: /^(?:[A-Za-z]+)(?:[A-Za-z0-9 _]*)$/ at this online regex tester.



This should work.



Cheers!


[#69377] Thursday, September 18, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raymondd

Total Points: 620
Total Questions: 112
Total Answers: 94

Location: Namibia
Member since Mon, Feb 21, 2022
2 Years ago
raymondd questions
Thu, Apr 22, 21, 00:00, 3 Years ago
Thu, Jul 9, 20, 00:00, 4 Years ago
Thu, Apr 9, 20, 00:00, 4 Years ago
Thu, Jul 25, 19, 00:00, 5 Years ago
;