Optimize regular expression in editor.js

Remove 'for' cycle and RegExp not useful.