Home > other >  RegEx for Including special character and characters inside a [ ]
RegEx for Including special character and characters inside a [ ]

Time:04-22

I have requirement to allow Special Characters and certain other characters for a field. I am using this regular expression:

"[a-zA-Z][a-zA-Z0-9._\\-]*[@][a-zA-Z0-9.\\-] [.][a-zA-Z] [a-zA-Z]"

So I need to add [at] instead of @ also add [.] insteat of . in my email validation

I try Like this

"[a-zA-Z][a-zA-Z0-9._\\-]*[\\[at]\\][a-zA-Z0-9.\\-] [\\[dot]\\][a-zA-Z] [a-zA-Z]"

But its Not Working and no idea to fix it.

CodePudding user response:

This worked for me:

"[a-zA-Z][a-zA-Z0-9._\\-]*\[at\][a-zA-Z0-9.\\-] \[dot\][a-zA-Z] [a-zA-Z]"
  • Related