Act fast, special offers end soon! Up to $294 is savings when you get Premium today.
Get offer codes

Unable to understand why "Java" at end of string won't be counted

Screen Link:

What does it mean by,

While the negative set was effective in removing any bad matches that mention JavaScript, it also had the side-effect of removing any titles where Java occurs at the end of the string, like this title:
“Pippo Web framework in Java”
This is because the negative set [^Ss] must match one character. Instances at the end of a string aren’t followed by any characters, so there is no match.

1 Like

This is your answer but if you still confused see the visually different between [Jj]ava[^Ss] and \b[Jj]ava\b

Visit -

  • [Jj]ava[^Ss] This will fail to detect ‘java’ when it is at the end of file or line. Because of [^Ss]; this required one-character after java and it should be other than S or s.

  • See it is detecting java in the starting of line because it has space after java but at the end it does not have any character after java so that was not detected

Visit -

Here, After using word boundary it can detect both java from string even it is at end of file.