<script> var str = '1-S1-002'; alert(str.match(/^\w+[-]\w+/)); //1-S1 </script> 转载于:https://blog.51cto.com/fluagen/130360