Jeanne Boyarsky wrote:The loop in your if statement and your else statement look exactly the same to me. I think you intended to reverse one.
Stephan van Hulst wrote:You could just add a optional comma to your lookahead, and make the quantifier after Link speed reluctant.
Stephan van Hulst wrote:You can do this with a zero width negative lookahead. Note that you can also make regular expressions case insensitive with the help of flags.
fred rosenberger wrote:Does it have to be a single regex? I always find that if I go to a huge effort to write a very complicated regex to meet all the criteria, then a week/month later when the criteria changes I am screwed.
Can you instead write a regex that finds all lines that have "current status", and then have a second regex to filter those that have "protocol"? If your criteria changes, it's pretty easy to add another that also filters (for example) "media", or that also allows "previous status".