Need some help with the regex to be used for extracting string between a start_pattern and an end_pattern. Additionally, the regex should grep all characters upto the end of line if no end_pattern exists.
Sample 1 : "BOOK1:book1A,book1B,book1C,book1D"
Expected Result : book1A,book1B,book1C,book1D
Sample 2 : "BOOK1:book1A,book1B,book1C,book1D|BOOK2:book2A,book2B,book2C,book2DA"
Expected Result : (1)book1A,book1B,book1C,book1D (2)book2A,book2B,book2C,book2DA
I've managed to resolve the regex (shown below) when the string terminator is "|", but cannot get around to resolving it when there is no terminator
(?<=BOOK1:).*(?=\|)