rrfeng
V2EX  ›  问与答

svn 里想用 pre-commit 禁止带有中文字符的文件名的提交,问题是:如何判断『中文字符』?

  •  
  •   rrfeng · Oct 21, 2014 · 4075 views
    This topic created in 4248 days ago, the information mentioned may be changed or developed.
    一种方式是限制可用字符,比如 [a-zA-Z0-9_\-\/] 这样

    但是可能会误杀

    如果没有好的判断方式,那就只能用上面的办法了
    3 replies    2014-10-21 14:15:29 +08:00
    dorentus
        1
    dorentus  
       Oct 21, 2014
    假如你们的项目是有文件的命名规范的,那么我觉得你这种用白名单来制定能用的字符的方式更好吧。
    yfdyh000
        2
    yfdyh000  
       Oct 21, 2014
    Google:中文 正则
    SoloCompany
        3
    SoloCompany  
       Oct 21, 2014 via Android
    一楼正解,要不我给你提交个带颜色的emoji文件名给你瞧瞧?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3670 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 10:38 · PVG 18:38 · LAX 03:38 · JFK 06:38
    ♥ Do have faith in what you're doing.