当前位置: 编程技术>其它
asp+正则获得字符串中最后一个字母非字母不算
来源: 互联网 发布时间:2014-10-14
本文导语: 代码如下: Function getLastWord(str) Set regEx = New RegExp regEx.Pattern = "(.*)([a-zA-Z])[^a-zA-Z]*" regEx.IgnoreCase = false regEx.Global = True str = regEx.Replace(str,"$2") getLastWord = str Set reg=nothing End Function str="1B2A3fdsafdsf32432432" Response.Write(getLas...
代码如下:
Function getLastWord(str)
Set regEx = New RegExp
regEx.Pattern = "(.*)([a-zA-Z])[^a-zA-Z]*"
regEx.IgnoreCase = false
regEx.Global = True
str = regEx.Replace(str,"$2")
getLastWord = str
Set reg=nothing
End Function
str="1B2A3fdsafdsf32432432"
Response.Write(getLastWord(str)):Response.End()