├── .gitattributes ├── LICENSE ├── README.md ├── scripts └── index.js └── test └── index.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 oualid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Regexer 2 | A New Way To Write Your Regular Expression. 3 | 4 | Writing regular expression is a big headache, but with Regexer you can write your regex easily. 5 | 6 | With Regexer you can write your Regular Expression like SQL statement. 7 | 8 | ## Examples: 9 | 10 | ###### RegEx: /abc/ 11 | ###### Regexer: SELECT 'abc' 12 | 13 | ###### RegEx: /^abc/ 14 | ###### Regexer: SELECT 'abc' AT BEGINNING 15 | 16 | ###### RegEx: /abc$/ 17 | ###### Regexer: SELECT 'abc' AT END 18 | 19 | ###### RegEx: /ab(?= c)/; 20 | ###### Regexer: SELECT 'ab' FOLLOWED BY 'c' 21 | 22 | ###### RegEx: /(?<=")(abc)(?=")/ 23 | ###### Regexer: SELECT 'abc' BETWEEN '"' 24 | 25 | ###### RegEx: /abc/g 26 | ###### Regexer: SELECT ALL 'abc' 27 | -------------------------------------------------------------------------------- /scripts/index.js: -------------------------------------------------------------------------------- 1 | // SELECT "abc" AT BEGINENING 2 | const readline = require('readline').createInterface({ 3 | input: process.stdin, 4 | output: process.stdout 5 | }); 6 | 7 | function newQuery(){ 8 | readline.question('tap your query: ', query => { 9 | if( query === 'exit' ){ 10 | readline.close(); 11 | return; 12 | } 13 | 14 | const queryReplace = query.replace(/(\r\n|\n|\r)/gm, ' '); 15 | const querySplit = queryReplace.split(/ (?=(?:(?:[^"]*"){2})*[^"]*$)/); 16 | const queryFilter = querySplit.filter(i => { return i.trim() != '' }); 17 | 18 | queryFilter.forEach( v => { console.log( v.trim() ); }); 19 | 20 | newQuery(); 21 | }); 22 | } 23 | 24 | newQuery(); -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | console.log('Regexer Test...') --------------------------------------------------------------------------------