hello,
I tried to write a simple RegExp to remove Numbers in string between square brackets
input string: Exeere 4242 [111AAAA222 222 BBB33333,33CCCC444-44DDDD5555]
Numbers in RED color should be removed.
Wanted Result = Exeere 4242 [AAAA BBB,CCCC-DDDD]
How can i do this?
Hint:
I wnat to remove any Numbers in the string between brackets regardless of the pattern of this string. (the pattern of the string between brackets may change)
I have posted this query in other forum and i get some solutions but am looking a silmpler code.
cross linked thread
I tried to write a simple RegExp to remove Numbers in string between square brackets
Code:
Dim oRegExp As New RegExp, sName As String
With oRegExp
.Global = True
sName = "Exeere 4242 [111AAAA222 222 BBB33333,33CCCC444-44DDDD5555]"
.Pattern = "(\[)" & "(\D*)\d+(\D*)" & "(\])"
sName = .Replace(sName, "$1$2$3$4" & "")
Debug.Print sName
End With
input string: Exeere 4242 [111AAAA222 222 BBB33333,33CCCC444-44DDDD5555]
Numbers in RED color should be removed.
Wanted Result = Exeere 4242 [AAAA BBB,CCCC-DDDD]
How can i do this?
Hint:
I wnat to remove any Numbers in the string between brackets regardless of the pattern of this string. (the pattern of the string between brackets may change)
I have posted this query in other forum and i get some solutions but am looking a silmpler code.
cross linked thread