例子: // 删除以0开头的字段 DELETE FROM `week_energy_copy` WHERE openid like '0%'; // 删除以数字开头的字段 DELETE FROM `week_energy_copy` WHERE openid NOT REGEXP '^[0-9]'; // 删除以大写字母开头的字段 DELETE FROM `week_energy_copy` WHERE openid REGEXP '^[A-Z]';
js 正则 以字母开头必须有 大小写字母数字组成 可以有“@"或 ”.“ var reg = /^[a-zA-Z]{1}(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d_@\.]{6,16}$/; var v = reg.test(str); alert(v); //校验是否全由数字组成 function isDigit(s) { var patrn=/^[0-9]{1,20}$/; if (!patrn.exec(s)) return false return tr
换行的字符串 "This string\nhas two lines" 字符串中使用单引号时应该怎么写 'You\'re right, it can\'t be a quote' 把数字变成字符串并保留两位小数 var n = 123456.789 n.toFixed(0); //"123457" n.toFixed(2); //"123456.79" parseFloat(str)str以非数字开头,则返回NaN parseFloat(str)