Description
This regex will do the following:
- Match the sub strings starting with
Acid to Probable - Requires
Acid and Probable to be on their own line. If they are embedded in the middle of a string like gooProbablegoo these won't match
For this regex I used the Case Insenstive flag, and Dot matches new line Flag.
(?:\r|\n|\A)\s*Acid\s*?[\r\n].*?[\r\n]\s*Probable\s*?(?:\r|\n|\Z)

Example
Sample Text
Note: the difficult edge case in the third line.
Acid stuff gooProbablegoo nasty Probable Acid more stuff Probable Acid fff ggg Probable
Matches
[0][0] = Acid stuff gooProbablegoo nasty Probable [1][0] = Acid more stuff Probable [2][0] = Acid fff ggg Probable
Explained
NODE EXPLANATION ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- \r '\r' (carriage return) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- \n '\n' (newline) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- \A the beginning of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- Acid 'Acid' ---------------------------------------------------------------------- \s*? whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- [\r\n] any character of: '\r' (carriage return), '\n' (newline) ---------------------------------------------------------------------- .*? any character (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- [\r\n] any character of: '\r' (carriage return), '\n' (newline) ---------------------------------------------------------------------- \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- Probable 'Probable' ---------------------------------------------------------------------- \s*? whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- \r '\r' (carriage return) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- \n '\n' (newline) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- \Z before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping
Acidoptional, for some reason), so the problem probably comes when you're trying to use it. Show the code where you actually matched this compiled pattern.