Open msadakov opened 9 years ago
@devmru Would you comment with the exact search and replace text you entered? It's not entirely clear from you original comment.
Procedure: Ctrl+F -> input "find" set value "/var/www/" -> input "replace" set value "/home/max/www/" -> button "all" click -> Error
@devmru thanks
Seems to be an issue with the Codemirror search/find plugin. Can reproduce the problem here: https://codemirror.net/demo/search.html
Since it's a regex behind the scenes you'd have to write something like: Find: /\/var\/www\// Replace: /\/home\/max\/www\//
I did some tests. Problem "/" early search
Ctrl+F -> input "find" set value "/var/www/" -> input "replace" set value "/home/max/www/" -> button "all" click -> Error Ctrl+F -> input "find" set value "var/www/" -> input "replace" set value "/home/max/www/" -> button "all" click -> No error
@devmru @rundis This seems to be the problematic code:
function isRegex(s) {
if(s instanceof RegExp) return true;
return s.match(/^\/(.+)\/([a-z]*)$/);
}
It'd be nice to continue supporting regexes so we need some way to distinguish between regular strings and regexes. Unless we treat everything like a regex. Maybe we could just treat any input
as /input/g
? Or maybe we could tweak the regex-regex in the isRegex
function to not match /var/www/
, if that's even possible (or desirable).
As-is, /var/www/
seems like the perfect input to break something that's trying to support both plain text and regex expressions.
no checkbox to select regex / non-regex search, nice...
@danmbox Pull requests welcome.
The search can not handle at the beginning and at the end with a "/", and then replaced.
Error:
Without the "/" all right