git ssb


10+

Dominic / patchbay



Escape strings for regexes

%0CwUC+z/g6EWQyDSKZuK/EEF2N7d74/s7XYSMBaDjfY=.sha256
Closed cel wants to merge commits into master from escape-regexes
cel · 2/14/2017, 1:12:05 PM

Escape strings for regexes

Fix errors that happens when you use control characters in things that get turned into regexes.

e.g. in the composer, type @asd), and get this error:

SyntaxError: Invalid regular expression: /^@asd)/: Unmatched ')'
    at RegExp (native)
    at /home/cel/src/patchbay/modules_core/names.js:174:14
    at go (/home/cel/src/patchbay/modules_core/names.js:152:33)
    at Object.<anonymous> (/home/cel/src/patchbay/modules_core/names.js:153:17)
    at Object.signified (/home/cel/src/patchbay/node_modules/depject/apply.js:15:30)
    at /home/cel/src/patchbay/modules_core/suggest-mentions.js:28:11
    at invokeSource (/home/cel/src/patchbay/node_modules/continuable-list/index.js:17:13)
    at Array.forEach (native)
    at continuable (/home/cel/src/patchbay/node_modules/continuable-list/index.js:16:15)
    at suggester (/home/cel/src/patchbay/modules_core/suggest-box.js:23:9)

also, try a search with a control character: ?asd)

This PR should fix the error both cases

mix deleted the escape-regexes branch · 2/14/2017, 11:57:56 PM
%KVlt0IjdH2i7AxGZVlz+LjdEtRUy8r3J/TQNnMYDVP4=.sha256 mix · 2/14/2017, 11:58:32 PM

Nice one ! merged


Built with git-ssb-web