like-to-regexp
v0.0.3
Published
Convert sql like query to regexp
Downloads
2
Maintainers
Readme
like-to-regexp
Transform sql like query to a valide regexp.
| SQL LIKE | ReGexp | |----------|-----------------| | value | /^value$/i | | %value% | /^.value.$/i | | value% | /^value.*$/i | | %value | /^.*value$/i | | v_lue | /^v.lue$/i |
Install
yarn add like-to-regexp
Usage
import toReGexp from 'like-to-regexp'
const regexp = toReGexp('%value%')
if (regexp.test('value')) console.log('Hello world')