1
qinxg 2013-09-12 17:33:57 +08:00
[^A]
|
2
felix021 2013-09-12 17:39:56 +08:00 1
正则入门不是只要30分钟吗....痛苦在哪?
|
3
yushiro 2013-09-12 17:40:22 +08:00 1
chrome 的console模式下运行:
'A1 A2 A3 A4 5A 66'.replace(/A([0-9])/g,'$1') |
5
yushiro 2013-09-12 17:47:29 +08:00
@123123 被editplus折腾的,因为在editplus里面不支持\d, 还有好多操作都不支持。。。。。。所以习惯用0-9这种了=_=#
|
6
Mutoo 2013-09-12 17:58:15 +08:00 1
可以用零宽断言,找到后面的数字的A
"A1 A2 A3 A4 5A 66".replace(/A(?=\d)/g,"") |
7
yakczh 2013-09-12 18:00:17 +08:00 1
<script>
var a='A1 A2 A3 A4 5A 66' ; a=a.replace(/A(\d\s)/g,"$1"); //alert(a); document.write(a); </script> |
8
solos 2013-09-12 18:00:49 +08:00 1
可以用环视,'A1 A2 A3 A4 5A 66'.replace(/(?=A\d)A/g, '')
|
9
Ever 2013-09-12 18:04:21 +08:00 1
'A1 A2 A3 A4 5A 66'.replace(/\bA/g,'')
|
10
Alexisused 2013-09-12 18:12:12 +08:00 1
'A1 A2 A3 A4 5A 66'.replace(/A(\d)/g, '$1')
|
11
yyife 2013-09-12 18:23:50 +08:00 1
var s = 'A1 A2 A3 A4 5A 66' ;
var reg = /A(\d+)/g; console.log(s.replace(reg,function(w){return w.substr(1,w.length);})); 可以随意处理 |