
Option Explicit
Function RegExpReplace(selectString As String) As String
Dim objRegExp As Object
Set objRegExp = CreateObject("vbscript.regexp")
With objRegExp
.Global = True
.IgnoreCase = True
If Len(selectString) = 1 Then
.Pattern = ""
Else
.Pattern = "(S|F)$"
End If
RegExpReplace = .Replace(selectString, "")
End With
End Function |
Option Explicit
Function RegExpReplace(selectString As String) As String
Dim objRegExp As Object
Set objRegExp = CreateObject("vbscript.regexp")
With objRegExp
.Global = True
.IgnoreCase = True
.Pattern = "(FER|DISP|MAL|DS)"
If .test(selectString) Then
RegExpReplace = "AS"
Else
If Len(selectString) = 1 Then
.Pattern = ""
Else
.Pattern = "(S|F)$"
End If
RegExpReplace = .Replace(selectString, "")
End If
End With
End Function
|
Function RegExpReplace(selectString As String) As String
Dim objRegExp As Object
Set objRegExp = CreateObject("vbscript.regexp")
' With objRegExp
' .Global = True
' .IgnoreCase = True
' If Len(selectString) = 1 Then
' .Pattern = ""
' Else
' .Pattern = "(S|F)$"
' End If
'
' RegExpReplace = .Replace(selectString, "")
'
' End With
With objRegExp
.Global = True
.IgnoreCase = True
If Len(selectString) = 1 Then
.Pattern = "(MAL|DISP|FER|DS)"
Else
.Pattern = "(MAL|DISP|FER|DS)$"
End If
RegExpReplace = .Replace(selectString, "AS")
End With
End Function |
Function RegExpReplace(selectString As String) As String
Dim objRegExp As Object
Set objRegExp = CreateObject("vbscript.regexp")
With objRegExp
.Global = True
.IgnoreCase = True
.Pattern = "(S|F)$"
s = selectString
If .test(s) Then
RegExpReplace = .Replace(selectString, "")
Else
.Pattern = "(MAL|DISP|FER|DS)$"
RegExpReplace = .Replace(selectString, "AS")
End If
End With
End Function
|
Function RegExpReplace(selectString As String) As String
Dim objRegExp As Object
Set objRegExp = CreateObject("vbscript.regexp")
With objRegExp
.Global = True
.IgnoreCase = True
.Pattern = "(MAL|DISP|FER|[DS]{2})$"
s = selectString
If .test(s) Then
RegExpReplace = .Replace(selectString, "AS")
Else
.Pattern = "(S|F)$"
RegExpReplace = .Replace(selectString, " ")
End If
End With
End Function |
RegExpReplace = "AS" <<<===da modificare in RegExpReplace = .Replace(selectString, "AS") |
