Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate a UPI ID using regex?

It's like an email ID but can start from a digit also and doesn't have a domain at the end.

Examples:

rishi.21@axis
shruti@PNB
98765__210@upi
like image 583
Sahil Kapoor Avatar asked Jan 01 '23 04:01

Sahil Kapoor


1 Answers

Ideally there is a minimum number of characters before and after @. Hence following can be added for same:

[a-zA-Z0-9.\-_]{2,256}@[a-zA-Z]{2,64}
like image 90
Tarun Deep Attri Avatar answered Jan 03 '23 17:01

Tarun Deep Attri