Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validator

 
Ganapathy palanisamy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
I working on validation for the phone no.

now i want to all the land line no also . If i am using the landline i need to allow the thy symbol -
so help to validate special symbols and space in phone no.

please help me to finish it.


 
sri ramvaithiyanathan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

struts validation is based on regular expression.

so replace your code ^['',0-9]{12}$ into the below one.

^(\d{2}[\-])?(\d{3,5})[\-](\d{6,9})$
or
(\d{3,5})[\-]^['',0-9]{12}$
or
(\d{2}[\-])?(\d{3,5})[\-]^['',0-9]{12}$

Hope first one will work.

P.S : waiting for your reply.

Regards,
Ram.

 
Ganapathy palanisamy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh fine man. Thanks
 
sri ramvaithiyanathan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whether you tried.
Got the expected output.

regards,
ram.
 
Ganapathy palanisamy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yes. I got the output.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic