What Regex would capture everything from ' mark to the end of a line?

前端 未结 7 1507
南方客
南方客 2020-12-12 16:32

I have a text file that denotes remarks with a single \'.

Some lines have two quotes but I need to get everything from the first instance of a \

相关标签:
7条回答
  • 2020-12-12 17:30

    https://regex101.com/r/Jjc2xR/1

    /(\w*\(Hex\): w*)(.*?)(?= |$)/gm
    

    I'm sure this one works, it will capture de hexa serial in the badly structured text multilined bellow

         Space Reservation: disabled
             Serial Number: wCVt1]IlvQWv
       Serial Number (Hex): 77435674315d496c76515776
                   Comment: new comment
    

    I'm a eternal newbie in regex but I'll try explain this one

    (\w*(Hex): w*) : Find text in line where string contains "Hex: "

    (.*?) This is the second captured text and means everything after

    (?= |$) create a limit that is the space between = and the |

    So with the second group, you will have the value

    0 讨论(0)
提交回复
热议问题