Open Sogl opened 9 years ago
Thank you :+1: !
I am able to reproduce this behavior on Windows 8. Investigating currently what is going on.
Okey, this unfortunately is a standard behavior for regular expressions (TIL).
Source: https://en.wikipedia.org/wiki/Regular_expression
\b Matches a zero-width boundary between a word-class character (see next) and either a non-word class character or an edge. \w Matches an alphanumeric character, including ""; same as [A-Za-z0-9] in ASCI ...
So the $
character is breaking the search. This is the behavior I got also from using Chrome's DevTools console and also interactive sites (e.g. http://regexpal.com/)
But I have turned off the Regex option.
Sorry, I didn't explain it well. When you enable whole word option it will escape your string, add \b
at the beginning and end of the string you are searching and use regexp matching for it .. that is the reason why is it not working.
I am going to try some editors to see if this is standard behavior there too or using \b
is an approach that is not feasible.
My example (on screenshots) also doesn't work for you?
Nope, it doesn't and the reasons are clear. Whole word search is using regular expressions and \b
internally and that doesn't work well with PHP variables.
I tried Sublime Text 3 (EDIT: and also in Ace) the behavior is the same as for Atom. You cannot search for whole words that contain $
:
Hovewer in Notepad++ it works:
Hm, Notepad++ works fine :smile:
Question for Atom developers (or anyone else):
What do you think about showing an error message when someone enables whole word option and the text contains \W
character(s)?
This makes it however "interesting" when regexp option is turned on. Notepad++ is solving that by disabling the whole word option when regexp is selected.
Since this issue is almost 6 years old and PHP is the language everyone loves to hate, I think we can safely assume it will not be fixed. Here is the workaround I use in the search pane:
Enable the .*
regex option.
Disable the whole word option.
\$variable\b
Basically surround the search in \
and add b
on the end. It works well enough I guess.
I love the extensibility of Atom, but am hitting such daily friction with inexplicable lags and critical (but non-core) packages breaking that it's become a problem. Package Cop helps, but unfortunately has such a poor user interface that I can't always isolate misbehaving packages in a reasonable amount of time. I'm sensing enough of this errata reaching critical mass that it may be time to jump ship to VS Code. I've felt that way for several years but still stubbornly cling to Atom because I believe in the dream of web everywhere and building software modularly. It's just hard when all of the billions of dollars go to giant corporations that don't need it while the open source community depends on overworked developers to fight through burnout and contribute, reminiscent of the shanty town beneath the skyscrapers in Dubai.
Hi!
I use Atom 1.0 on Windows 7 x64.
Whole word option is enabled. If I try to replace some variables in PHP with
$
, replace doesn't work. Works only without$
. Also find don't working with$
.More info here: https://github.com/atom/atom/issues/7724