none
Regular expression to get group of chars after last delimiter? RRS feed

  • Question

  • Hi, 

    I have the following inputs,

    123456789_ABC123_90045678

    12345600_ABC_ABCDE123

    999045600_456_A123B456D

    I have a problem to figure out the regular expression I should use to get the bold set of chars after last delimiter (underscore _ in this case), would the following work? 

    ^(?<ID1>\d).*[A-Za-z._](?<ID2>\w).*

    Or if any web link I can try my expression above? 

    Appreciated. 

    Wednesday, June 5, 2019 10:46 PM

All replies

  • A = "123456789_ABC123_90045678"
    OffSet = InStrRev(A, "_") + 1
    MsgBox Mid(A, Offset)

    String operations are more efficient for some things than RegEx.


    David Candy

    Sunday, June 9, 2019 7:38 PM