Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't generate a literal plus '+' character #12

Open
cimbriano opened this issue Apr 8, 2013 · 5 comments
Open

Can't generate a literal plus '+' character #12

cimbriano opened this issue Apr 8, 2013 · 5 comments

Comments

@cimbriano
Copy link

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
Copy link

avelis commented Jan 26, 2014

+1 to address this as well.

@mockaroo
Copy link

+1 In general is there a way to generate literal reserved characters such as "?" and "|"?

@bhagyas
Copy link

bhagyas commented Sep 12, 2014

+1

1 similar comment
@konstantin-dzreev
Copy link

+1

@tom-lord
Copy link

tom-lord commented Mar 3, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants