【问题标题】:How can I found and replace umlauts in filenames?如何查找和替换文件名中的变音符号?
【发布时间】:2019-09-26 13:58:00
【问题描述】:

我有一个正则表达式可以在字符串中找到字符:

^[A-Za-züäöÜÄÖ$@߀0-9\.\-_ \&\<\>\=\`\:#\{\}\,\(\)\"\'\+\]\[\/%;!?\\\n]{0,20000}$

当我从 'tüst.txt' 之类的文件中成为带有 js 的名称时,正则表达式与字符串中的 'ü' 不匹配。

如何在文件名中找到“ü”?还是其他变音?

提前谢谢你

【问题讨论】:

    标签: javascript regex replace filenames


    【解决方案1】:

    This answer 建议使用 unicode 字符而不是实际将变音符号放入正则表达式。它的 unicode 是 \u00fc - 链接的答案包括一个其他常见德语字符表,并且对该答案的评论包括指向 unicode table. 的链接

    你可以在 javascript 中使用 unicode 做很多事情 - it's worth reading more about!

    【讨论】:

      猜你喜欢
      • 2013-12-23
      • 2021-09-02
      • 2010-10-26
      • 2012-07-24
      • 1970-01-01
      • 2012-01-28
      • 1970-01-01
      • 2016-10-09
      • 1970-01-01
      相关资源
      最近更新 更多