Regex to get the words after matching string

前端 未结 6 1046
予麋鹿
予麋鹿 2020-11-27 02:33

Below is the content:

Subject:
    Security ID:        S-1-5-21-3368353891-1012177287-890106238-22451
    Account Name:       ChamaraKer
    Account Domain:          


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 03:20

    You're almost there. Use the following regex (with multi-line option enabled)

    \bObject Name:\s+(.*)$
    

    The complete match would be

    Object Name:   D:\ApacheTomcat\apache-tomcat-6.0.36\logs\localhost.2013-07-01.log
    

    while the captured group one would contain

    D:\ApacheTomcat\apache-tomcat-6.0.36\logs\localhost.2013-07-01.log
    

    If you want to capture the file path directly use

    (?m)(?<=\bObject Name:).*$
    

提交回复
热议问题