#4368 Search whole word fails on PHP variable

1.x
open
nobody
None
5
2013-06-25
2013-06-25
David Hartley
No

Searching for a PHP variable including the $ with 'Match whole word only' set fails if the $ is preceded by common characters like ( or ! or [ or +

Space is ok.

Example: A whole word search on $index in the following sample code snippet finds only THREE of the NINE occurrences of $index :

$index = 0; # found
if ($index) ++$index; # not found, not found
if (!$index) ++$index; # not found, not found
if ( $index) ++$index; # found, not found
$ele = $MyArray[$index]; # not found
$ele = $MyArray[ $index ]; # found

This failing has several times caused me to try other editors which do not exhibit this problem e.g. EditRocket but I like Notepad++ in other respects, even though I still get infrequent "(" character insert crashes as reported as Bugs 3579 and 3974 in 2011, 2012, still not fixed. I do realise that this is hard one as it is not reproducible i.e. it depends on the editing history = buffer related? (The frequency of the error has reduced from when I first reported it however to a now almost tolerable level - with a groan - of about once a month, and I live in npp all day long.)

This whole word search bug must be a common problem for PHP developers. Sure, a whole word search on the variable without the $ i.e. on "index" in this case, does work, but then that finds 'index' in comments and text etc.

It is a common requirement to want to be able to do a whole word search on a PHP variable including the $, so I, and other PHP developers I am sure, would greatly appreciate this being fixed please.

Then fix the "(" insert bug fully please!

Otherwise, as I have said, I really like Notepad++ thank you.

Discussion