regexp-tree icon indicating copy to clipboard operation
regexp-tree copied to clipboard

Question about Optimization

Open coderaiser opened this issue 4 years ago • 1 comments

Thank you for a library with such hight quality :). I just integrated regexp-tree into Putout linter, run it on my code, and had seen a strange optimization:

require('regexp-tree').optimize(/[<>=!]/).toString()
'/[!<=>]/'

Could you please tell me is it more optimized regexp or it's a bug?

coderaiser avatar Nov 23 '20 17:11 coderaiser

Thanks for the feedback! As to the optimization: yes, this seems is a consequence of optimizing character classes, and sorting the chars as a side effect.

DmitrySoshnikov avatar Jan 20 '21 05:01 DmitrySoshnikov