正则表达式
1.判断是不是URL
let s1 = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/g;
2.判断是不是以英文和下划线组成
let regex = /^[a-zA_Z]*_*$/;
3.判断是不是以&#开头 ;结束
let regex = /^&#.*;$/;
4.防注入sql
.*( and |exec |insert |select |delete |update | count |%| chr | mid | master | truncate |char |declare | or |show |drop ).*

浙公网安备 33010602011771号