- Javascript使用正则表达式替换的问题我想把col1+co
- 我想把col1+col2+col3*col4-col5/col6...+colN替换成
parseInt( lue)+parseInt( lue)+parseInt( lue)+parseInt( lue)....
这样的怎么写?
- 问题描述不清楚,不知道是不是这样?
<%
Function ReplaceExp(srcstr, patrn, replStr)
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
regEx.Execute(srcstr)
ReplaceExp = regEx.Replace(srcstr, replStr)
Set regEx = Nothing
End Function
NewStr = ReplaceExp(OldStr, "/(col\d+)[\+\-\*\/](col\d+)/", "$1+$2")
NewStr = ReplaceExp(NewStr, "/col(\d)+/", "parseInt( l$ lue)")
%>