|
|
|
|
|
by elanning
1758 days ago
|
|
I recently wrote a little Regex domain specific language that's translated into regular JavaScript regex. I was inspired by CCGrep: https://arxiv.org/abs/2003.05615 because its syntax looked so clean and yet powerful. Examples of it look like `$# ($a == $1) { return $$$; }`
$# - match any keyword, eg `do`, `while`, etc.
$a - match any variable.
$1 - match any literal.
$$$ - match any block (greedy). It's also whitespace invariant, so `if($a==$1)` is equivalent to `if ($a == $1)`. All that to say, I wonder if we're missing out on a variety of "domain specific regexes" for various fields. |
|