Reported here: https://meta.wikimedia.org/wiki/Talk:Community_Tech/Wikitext_editor_syntax_highlighting#Fail:_Search_and_Replace
I was not able to reproduce on the same OS and browser, but a user is reporting that:
I'm having a somewhat similar issue in that the search and replace doesn't actually replace anything if I choose "Replace all" with syntax highlighting on. Individual replace works fine with it on, and "Replace all" works fine with it off, though. I'm on Firefox (58.0.2) and OS X.