如何匹配VBA中的所有空格

时间:2018-06-27 14:18:56

标签: regex excel vba

我遇到类似的问题as this question here\s与VBA中的所有空白都不匹配。

但是我想抓住all kinds of whitespace - spaces, tabs, newlines, thin space, hair space etc.,而不仅仅是其中之一。

除了对每个unicode值进行如下硬编码之外,还有其他可能性吗?

With regEx
    .Global = True
    .Pattern = "(\s|\u2009|\u2008|.............)"
End With

1 个答案:

答案 0 :(得分:2)

使用此正则表达式模式应该很安全:

[\s\n\r\t \xA0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000\uFEFF]+