【发布时间】:2022-01-26 19:32:52
【问题描述】:
我需要检测给定的文件名是否包含任何希伯来字母。 (基本上,我的文件管理代码只需要对文件名中包含希伯来语的文件进行操作。)
Powershell 会如何检测文件名中是否有希伯来字母? (或者,我想,在任何字符串中)。
(FWIW 我在 Windows10 上)
【问题讨论】:
-
您好,我认为link 中的答案就是您想要的。
标签: powershell
我需要检测给定的文件名是否包含任何希伯来字母。 (基本上,我的文件管理代码只需要对文件名中包含希伯来语的文件进行操作。)
Powershell 会如何检测文件名中是否有希伯来字母? (或者,我想,在任何字符串中)。
(FWIW 我在 Windows10 上)
【问题讨论】:
标签: powershell
作为Abraham Zinala points out in the comments,您可以通过描述the appropriate unicode ranges of Hebrew characters and diacritics来测试给定字符串中的任何字符是否匹配:
PS ~> "No hebrew here" -match '[\u0590-\u05FE\uFB1D-\uFB4F]'
False
PS ~> "עִבְרִית" -match '[\u0590-\u05FE\uFB1D-\uFB4F]'
True
【讨论】: