javallone / regexper Goto Github PK
View Code? Open in Web Editor NEWRegular Expression Visualization Site
License: Other
Regular Expression Visualization Site
License: Other
Please add a Favicon for the site so that it is easily recognizable in the bookmarks bar. Right Now it looks like this: http://i.imgur.com/xhQ2pVL.png , and is indistinguishable from the other sites without favicons.
The site raise this error
My regexp = ((,+[\w\s.ñáéíóú]+,)|(,[\w\s.ñáéíóú]+))
Error page
Expected one of ?, (, [, ., , $, |, ) at line 1, column 5 (byte 5) after ((,
But in this page really works http://rubular.com/r/r9CF35OgNZ
Following regex throw a server error:
(([A-Z]+))?
Don't know how to express this visually yet, but expressions that use a non-greedy repetition (*?, +?, ??, {x,y}?) should be rendered to indicate that the repetition is not greedy.
Any signed letter like "á" or non-ASCII character like "ñ" breaks the thing and get a Server error
eg. exports to png/svg..
this will be grateful
because some time we need save the results
in pattern '[every]' the 'e' while show twice,is this a problem ?
Loading the page with a current hash or changing the hash will trigger a display of the regexp in the URL.
var s = "123, 12 1 2"
var p = /1 | 2/
s.match(p)
['1 ']
in regexper, the white space not display
This throws a server error:
(((a*)))
It would be nice if I could enter an expression, then get a link to a page that will display that expression to others.
Since this app emphasizes readability, it would be nice to observe proper grammar if a regex is specifying that something should only repeat once. Consider:
[a-z]{1}
Regexper will describe that as repeating "1 times". There should be conditional formatting on line 54 of repetition.js
.
Something like this would do the trick:
loop_desc = repeat_count + ' time' + ((repeat_count === 1) ? "" : "s");
Or even:
loop_desc = ((repeat_count === 1) ? "once" : repeat_count + " times");
Great work though!
This can be verified by entering longer regex statements:
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_
{|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(.([a-z]|\d|[!#$%&'*+-/=?^_{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.| _|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/
The app is great, really, but it lacks the ability to share regular expression visualizations.
Expression /^(\d{,2})$/
should be parsed as string, not as quantifier
I'd like to see “[no linefeed]” instead of “none of [[linefeed]]” for the RegEx [^\n]
, and “[" "]” (or similar) instead of “One of [[" "]]” for the regex [ ]
.
(Brackets stand for node frames)
This expression throws a "Server error"
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+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^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".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()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*))*)?;\s*)
This regex
(?<!\+)\+(?!http)
produces error
Expected ? at line 1, column 3 (byte 3) after (?
but I believe is valid because it is parsed elsewhere http://rick.measham.id.au/paste/explain.pl?regex=%28%3F%3C%21%5C%2B%29%5C%2B%28%3F%21http%29
The license this work is released under is extremely restrictive. Specifically, it prohibits the use of this work in any commercial product, and forces any work that is built on top of this code to be non-commercial as well.
Would you be prepared to release it under a less restrictive license, such as MIT or BSD. I'm happy to continue to include attribution for the original work you did, but I want to make the work available for people to use in more interesting (and helpful) scenarios.
If you have whitespace at the end or beginning of a regular expression, it comes back as an error: invalid regular expression. Submissions should be trimmed before processing.
[a-z] is described as 'one of'
[a-z]+ is described as 'one of'
[a-z]+ should be described as "at least one of" or "one or more"
Same issue for zero or more quantifier.
Thanks for the nice webpage! Just discovered it.
Unicode characters can be matched with \uFFFF
(or \u{FFFF}
depending the engine) and those are supported by regexper.
But we can also refers to Unicode characters in others way:
\X
\p{L}
\p{Lu}
\p{M}
\p{Z}
\p{S}
\p{N}
\p{P}
\p{C}
More are available on this website http://www.regular-expressions.info/unicode.html, with explanation and examples.
So, the regex /^[\p{L}\s]+$/
will match a space or any Unicode letter, one or more times.
Looking at the code it seems to me the bulk of the work is done by the the TreeTop - the ruby PEG parser.
There are a few PEG parsers for javascript, so it may be possible to do the entire processing in the client side (javascript) entirely.
This will allow instant feedback (ie. render every keyup event), and also some super cool plugin for IDEs which support javascript plugins.
When you hover over a part of the diagram you could highlight the part of the text that is responsible for that section of the diagram.
(..csproj$)|(..sln$)
any string that ends in either .csproj or .sln (the "." in the regex visualizer is considered as "any character")
These two regular expression work differently
yes their images are the same.
\d+(?:.\d+?)? and
\d+(?:.\d+)?
^^$$
[
{
"type": "basic_RE",
"value": "^^$$",
"childs": [
{
"type": "start-of-line",
"value": "^"
},
{
"type": "char",
"value": "^"
},
{
"type": "char",
"value": "$"
},
{
"type": "end-of-line",
"value": "$"
}
]
}
]
It would be really useful to be able to test out the regex on sample data as well. E.g., for a regex of "\d+", perhaps I might throw the following sample data at it:
"a"
""
"0"
"235"
"aslfj235"
A really cool thing to do with this would be to highlight the path through the state machine that is taken when evaluating a piece of sample data.
Two options, strip the beginning and trailing slashes if they are present (and not properly escaped) or support parsing them.
Just a simple list of expressions to demonstrate with. Probably best to wait until after #7 is complete.
Not a code issue, but http://regexper.com/ cannot be accessed.
A formated source of an regexp with your comments would be nice, so it can be copied direct into a js-file.
Example:
\/\/#[\[\(]hi world[\]\)]\/\/#[\[\(]test[\]\)]
output (for js):
'\/\/#'
+ '[\[\(]' // One of: "[", "("
+ 'hi world'
+ '[\]\)]' // One of: "]", ")"
+ '\/\/#'
+ '[\[\(]' // One of: "[", "("
+ 'test'
+ '[\]\)]'; // One of: "]", ")"
Same comments you use in your graphic.
Or exists a fork with that?
Do something better when the regexp encounters an error.
e.g. Show the compiled regexp up to the point of the error.
Perhaps something like: If compilation fails, insert an "error" token at the point of the error, close any groups, recompile. Now you can at least display the regex up to the point of error.
At least have regexper.com forward to www.regexper.com. Bad to spit an error at folks
In my uses, messages like "5 times" and "1...5" are displayed to {5} and {1,5} quantifiers, but not for another quantifiers.
This is a feature will be can add?
This regexp throws server error:
^\s_([(){}[]?.,:;'"~#@`]|={1,3}|/(_(jslint|properties|property|members?|globals?)?|=|/)?|*[/=]?|+(?:=|++)?|-(?:=|-+)?|[^%]=?|&[&=]?||[|=]?|>{1,3}=?|<(?:[/=!]|!([|--)?|<=?)?|!(!|==?)?|[a-zA-Z_$][a-zA-Z0-9_$]|[0-9]+(?:[xX][0-9a-fA-F]+|.[0-9])?(?:[eE][+-]?[0-9]+)?)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.