javascript下正则匹配百分比的代码
作者:
javascript下正则匹配百分比的代码
<script language="javascript">
var re = /^-?\d+%$/;
alert(re.test('50%'));
alert(re.test('-25%'));
alert(re.test('3a5%'));
</script>
var re = /^-?\d+%$/;
alert(re.test('50%'));
alert(re.test('-25%'));
alert(re.test('3a5%'));
</script>