如何使用RegEx解析表达式?

时间:2019-01-26 20:38:38

标签: regex powershell

我想知道是否可以在PowerShell中使用RegEx来获得所需的内容,或者是否需要为每个字符解析例程编写一个字符。

$TextToParse1 = "ONE = function(A,B,function(C,D),E);"      
# I would like to get the first function parameters in an array => $ParseParams = @('ONE','',('A','B','function(C,D)','E'))

$TextToParse2 = "TWO=Z:function(A,B,function(C,D),E,F,G);"  
# I would like to get the first function parameters in an array => $ParseParams = @('TWO','Z:',('A','B','function(C,D)','E','F','G'))

$TextToParse3 = @"
THREE = function(
    A,
    B,
    function(C,D),
    E);
"@
# I would like to get the first function parameters in an array => $ParseParams =@('THREE','',('A','B','function(C,D)','E'))

$TextToParse4 = @"
FOUR = function(
    A,
    B,
    function(
        C,
        D
    ),
    E);
"@
# I would like to get the first function parameters in an array => $ParseParams =@('FOUR','',('A','B','function(C,D)','E'))

0 个答案:

没有答案