Can't generate a literal plus '+' character
Opened this issue · 5 comments
cimbriano commented
Both of the following raise RuntimeError but are valid (shown below)
/\+/.gen
/[+]/.gen
RuntimeError: Sorry, "+" is too vague, try setting a range: "{1,3}"
RuntimeError: Sorry, "[+" is too vague, try setting a range: "[{1,3}"
:015 > "+".match(/\+/).string
=> "+"
:016 > "+".match(/[+]/).string
=> "+"
avelis commented
+1 to address this as well.
mockaroo commented
+1 In general is there a way to generate literal reserved characters such as "?" and "|"?
bhagyas commented
+1
konstantin-dzreev commented
+1
tom-lord commented
For more "accurate" generation of regex examples, check out my gem: https://github.com/tom-lord/regexp-examples
This gem seems better suited to generating one random example of a long pattern, e.g. /\w{10}/.gen
, but mine can correctly parse (almost) the WHOLE regex language.