Finalmente he resulto mi problema con una expresión regular. Por si alguien la necesita adjunto el código a continuación:
Código:
Function filtra_string(byval str)
Dim comienzo, strurl, colMatch,objMatch
Set regEx = New RegExp
regEx.Pattern = "((\+?34([ \t|\-|\.])?)?[9|6|7]((([ \t|\-|\.])?[0-9]{2}))([ \t|\-|\.])?[0-9]{2,3}([ \t|\-|\.])?[0-9]{2,3}([ \t|\-|\.])?[0-9]{0,3})"
regEx.Global = true
set colMatch = regEx.execute (str)
For each objMatch in colMatch
str = replace(str,objMatch.value,"[contenido bloqueado]")
Next
filtra_string = str
End Function
Con esta expresión puedo remplazar los teléfonos que empiezan con 34, 9, 7 y 6 y que están escritos en los siguientes formatos:
- XXXXXXXXX
- XXX.XXX.XXX
- XXX XXX XXX
- XXX.XX.XX.XX
- XXX XX XX XX
Damos el tema como solucionado. Un saludo