【问题标题】:Type of regex used by Sublime Text 3?Sublime Text 3 使用的正则表达式类型?
【发布时间】:2016-05-22 12:01:06
【问题描述】:

Sublime Text 3 使用什么类型的正则表达式? 正则表达式? Posix 扩展?

【问题讨论】:

    标签: regex sublimetext3


    【解决方案1】:

    Sublime 的 Search 和 Search 和 Replace 功能,以及 sn-ps、are powered by Boost 的 (Perl 兼容的正则表达式)engine,同时语法高亮语言定义(.tmLanguage.sublime-syntax 文件) 使用 engine,Ruby 也使用它。

    【讨论】:

    • 谢谢,原来是 Perl Regex
    • @Louis 在 sn-ps 中,是的 - /foo/bar/i 工作正常。在 Find 框中,不要使用正斜杠,也不要在末尾放置选项,而是 Find: (?i)foo Replace: bar
    【解决方案2】:

    这很奇怪。在regex101.com 上,它设置为pcre,我有一个完美的替换。然而在崇高的文本 3 中,它没有。

    在网站和ST3 中尝试以下操作:

    regex find: (testing.*)(0\.001\;)
    
    replace: $10.00;
    
    test text:
    //ActionList = testing { Name = "foo";  On = 0.001; Off = 1;    v = "tester";};
    

    【讨论】:

    • 好吧,sublime text 3 不喜欢在替换字段中引用捕获组时使用$。当我改用 \10.00; 时,它按预期工作。
    猜你喜欢
    • 1970-01-01
    • 2015-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多