How to extract substring in parentheses using Regex pattern

前端 未结 6 556
孤城傲影
孤城傲影 2020-12-09 11:36

This is probably a simple problem, but unfortunately I wasn\'t able to get the results I wanted...

Say, I have the following line:

\"Wouldn\'t It B         


        
6条回答
  •  旧巷少年郎
    2020-12-09 12:16

    This another Regex tested with a vbscript (?:\()(.*)(?:\)) Demo Here


    Data = """Wouldn't It Be Nice"" (B. Wilson/Asher/Love)"
    wscript.echo Extract(Data)
    '---------------------------------------------------------------
    Function Extract(Data)
    Dim strPattern,oRegExp,Matches
    strPattern = "(?:\()(.*)(?:\))"
    Set oRegExp = New RegExp
    oRegExp.IgnoreCase = True 
    oRegExp.Pattern = strPattern
    set Matches = oRegExp.Execute(Data) 
    If Matches.Count > 0 Then Extract = Matches(0).SubMatches(0)
    End Function
    '---------------------------------------------------------------
    

提交回复
热议问题