I have following text. I want to capture the pattern ddd-dd-ddd followed by all text until I again hit a ddd-dd-ddd.
I am trying to use this regex
\b[0-9]{3}-[0-9]{2}-[0-9]{3}\b.*
it matches 982-99-122 followed by the sentence until it hits a line feed. then again the second number 586-33-453 is matched followed by the text on the same line. but it fails to capture the text that continues on the next line.
OR if I remove the line feed from this string, it will only capture the first number 982-99-122 and captures the whole string i.e. does not match the second number 586-33-453
How should I fix both these issues, 1. when line feeds are part of the string and 2. when the string does not have line feeds.
982-99-122 (FCC 333/22) lube oil service pump 1b discharge lube oil service pump
aaa bb dsdsd
586-33-453 Matches exactly 3 times 0-e single character in the range between
dfldfldflkdf 545-66-666 sdkjsl () jdfkjd-kfdkf sdfl
848-99-040 sdsd"" df
dfdf
\b([0-9]{3}-[0-9]{2}-[0-9]{3})\b([\s\S]*?)(?=\b[0-9]{3}-[0-9]{2}-[0-9]{3}\b|$)?