1

I have some address as below

text #4/5, Some company & name with - in its name ltd.,
3rd cross, 5th main
(some land mark)
some place name
state, IN 566003

my regex below is not working

\d{1,5}\s\w.\s(\b\w*\b\s){1,2}\w*\.

for me

Yellow and Red
  • 695
  • 9
  • 31

2 Answers2

3

Found an answer

^(\w*\s*[\#\-\,\/\.\(\)\&]*)+
  • \w* match any word character [a-zA-Z0-9_]
  • \s match any white space character [\r\n\t\f ]
  • [\#\-\,\/\.\,\(\)\&]* match a single character present # - , . / ( ) &
  • + Between one and unlimited times
  • ^ assert position at start of the string
  • * Between zero and unlimited times
Yellow and Red
  • 695
  • 9
  • 31
1

use this regular expression. It may help you

^[0-9]+\s+([a-zA-Z]+|[a-zA-Z]+\s[a-zA-Z]+)$

Please try :)

Minas Jean
  • 107
  • 1
  • 14