What is difference between these two regular expression patterns?

Hello all,
I am doing the advanced regular expression section in 5th task that is “using lookaheads to control matches [\w]+”. :smiley: :smiley:

Okay my question is what is the difference between pattern2 and given answer.

Thank you


#pattern=r"(?<!Series\s)\b[Cc]\b(?![\+\.])" #DataQuest Answer


I have used these pattern2 and pattern in https://regexr.com/. They have given identical results. I have given a dummy set. Please open it in the website. My question is for what value of c can I get different results?

{c, c++,C,CFO.k,C.E.O, Cm,Cc,CCCCC,CETV,C++,
c++,c5,Series C, Series c, series C,series c}


The difference is that after the second question mark, they have different characters.

I’m being facetious to make a point: your question is unclear (it’s actually quite clear, only not asking what you really want to ask), and that should be obvious after you read my answer to your question. Also, please edit your question to include a link to the relevant screen.

In any case, after some effort, I managed to understand what you wanted to ask (I think). Here goes an answer.

The end of pattern2 can be put into words as "followed by a character different from both . and +". The end of pattern can be put into words as "not followed by + or .".
Do you see the difference?

Hi @Bruno, Thank you for your time.