grex

Command-line tool for generating regular expressions from user-provided test cases

Options

NameDescription
-d,--digitsConverts any Unicode decimal digit to \d
-D,--non-digitsConverts any character which is not a Unicode decimal digit to \D
-s,--spacesConverts any Unicode whitespace character to \s
-S,--non-spacesConverts any character which is not a Unicode whitespace character to \S
-w,--wordsConverts any Unicode word character to \w
-W,--non-wordsConverts any character which is not a Unicode word character to \W
-r,--repetitionsDetects repeated non-overlapping substrings and converts them to {min,max} quantifier notation
-e,--escapeReplaces all non-ASCII characters with unicode escape sequences
--with-surrogatesConverts astral code points to surrogate pairs if --escape is set
-i,--ignore-casePerforms case-insensitive matching, letters match both upper and lower case
-g,--capture-groupsReplaces non-capturing groups by capturing ones
-c,--colorizeProvides syntax highlighting for the resulting regular expression
-h,--helpPrints help information
-v,--versionPrints version information
-f,--file <command>Reads test cases on separate lines from a file
--min-repetitions <command>Specifies the minimum quantity of substring repetitions to be converted if --repetitions is set [default: 1]
--min-substring-length <command>Specifies the minimum length a repeated substring must have in order to be converted if --repetitions is set [default: 1]