简体   繁体   中英

How to prevent SQL injection for email validation in android

I want to perform UI validation in android. while validating email address, I want to check it is valid email address or not. But, I want to validate top-level domain and also i want to prevent SQL Injection from it.

Here is a pattern I used as follows :

^[A-Z0-9+_.-]+@[A-Z0-9.-]+$

Please suggest some Idea

Try this, It might help you to solve your expectations

 ^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[!#$%&'*+/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$

It will prevent SQL Injection while entering email address and also it will validate top-level domain names such as com, us, nz, au, ch like that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM