Mission 369-5: Advanced Regular Expression: error in regex pattern

Screen Link:

My Code:

pattern = r"(?<!Series\s)\b[Cc]\b((?![+.])|\.$)"
c_mentions = titles.str.contains(pattern).sum()
c_mentions

What I expected to happen:
I expected result like in the DQ screen but I get this answer:

pattern = r"(?<!Series\s)\b[Cc]\b((?![+.])|\.$)"
first_10_matches(pattern)

(upload://aWxNkp7xUnuZKwc5bCYdJyVMVIV.png)

What actually happened:

Replace this line with the output/error

As the second upload shows, the C at the end is still included in the selection - thus C values count is not accurate.

could someone please explain why I get this message and how to correct it.

thank you

I am not entirely sure I understand your issue clearly.

The regex is supposed to match instances when C is at the end of the sentence

Exclude instances where it is followed by a . or + character, without removing instances where the match occurs at the end of the sentence.

Isn’t that what you get as well?

Thank you for the reply;

My apologies; for some reason I was reading the text as wanting to exclude the C at the end:

My other, bigger, concern was the text in pink in the image suggesting I use str.extract. Why is that? would using the current form cause errors in certain cases??
Could you kindly provide any insights into this issue?

Thank you;

It’s a warning message that you can ignore, but, this reference should help you understand it better if you’d like to.

thank you very much i’ll look into it.