28,406
社区成员
发帖
与我相关
我的任务
分享str= "A3B5D10C4"
Dim regex, m
Set regex = New RegExp
regex.Pattern = "(\D)(\d+)"
regex.Global = True
For Each m In regex.Execute(str)
str = Replace(str, m.Value, String(m.Submatches(1), m.Submatches(0)))
Next
Set regex = Nothing
Response.Write str
Dim a, regex, ms, m
a = "A3B5D10C4"
Set regex = New RegExp
regex.Pattern = "([a-z])(\d+)"
regex.IgnoreCase = True
regex.Global = True
Set ms = regex.Execute(a)
For Each m In ms
a = Replace(a, m.Value, String(CInt(m.Submatches(1)), m.Submatches(0)))
Next
MsgBox a
var str = "A3B5D10C4";
alert(str.replace(/([A-Za-z])(\d+)/g, function($0, $1, $2)
{
var len = parseInt($2, 10);
var ret = [];
for (var i = 0; i < len; i++)
{
ret.push($1);
}
return ret.join("");
}));