0

I have the following string:

account management: | success, failure| default do

I want to match "success, failure". I can do that with the following expression:

(?<=[|])(.*)(?=[|])

However, there are cases where the pipe ("|") is missing. I tried the following to capture "success, failure":

(?<=success)(.*)(?=failure)

But that matches only the comma in the middle. Is there some way I can match a sub-string between 2 keywords and the match to include those keywords (I am working with python 3.x)? Thank you!

Adrian
  • 774
  • 7
  • 26

0 Answers0