0
  1. Alphabets allowed
  2. Number and Special characters are not allowed
  3. If you enter number one alphabet should be enter

https://www.regextester.com/

(^[a-zA-Z ]*)?(^[0-9 ]+[ a-zA-Z])*$

this expression is working only problem with when i type 123 main street it only allow 123 m i wanted to make it infinite

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476
user1137387
  • 1,783
  • 3
  • 17
  • 27

1 Answers1

0

Add + quantifier after your last class as the following suggests:

(^[a-zA-Z ]*)?(^[0-9 ]+[ a-zA-Z]+)*$

You should refrain from using regex to parse addresses though, it will break. See this post for more information

ctwheels
  • 20,701
  • 7
  • 36
  • 71