小编12s*_*w12的帖子

将长正则表达式拆分为多行?

有什么方法可以将正则表达式拆分为多行,这样它就不会超出编辑器的末尾?

if (!($_ -match 'e_eld\.s|od_eld\.|oe_eld\.s|of_eld\.s|og_eld\.s|1c_eld\.s|2c_eld\.s|3c_eld\.s|4c_eld\.s|1c_eld\.s|o2_eld\.s|o3_eld\.s|o4_eld\.s|o5_eld\.s'))
{
    # stuff
}
Run Code Online (Sandbox Code Playgroud)

当我尝试执行以下操作时,它不起作用。我也试过用`` 和所有其他技巧围绕它,但似乎没有任何效果,我找不到其他任何关于此的信息(也许我的搜索技巧很差)。

if (!($_ -match 'e_eld\.s|
                 od_eld\.s|
                 oe_eld\.s|
                 of_eld\.s|
                 og_eld\.s|
                 1c_eld\.s|
                 2c_eld\.s|
                 3c_eld\.s|
                 4c_eld\.s|
                 1c_eld\.s|
                 o2_eld\.s|
                 o3_eld\.s|
                 o4_eld\.s|
                 o5_eld\.s'))
{
    # stuff
}
Run Code Online (Sandbox Code Playgroud)

regex powershell

3
推荐指数
1
解决办法
119
查看次数

标签 统计

powershell ×1

regex ×1