4 ms·
I fed it a favorite regex... Bravo. Unfortunately, the permalinking fails with this particular regex, or I'd include it here. The visualization is so large, it
by jdnier 14y ago
I fed it a favorite regex... Bravo. Unfortunately, the permalinking fails with this particular regex, or I'd include it here. The visualization is so large, it more than fills my large screen. Still, pretty cool to see it render instantaneously and to watch it match example text. The regex is described here: http://www.cs.sfu.ca/~cameron/REX.html http://www.cs.sfu.ca/~cameron/REX.html
It will match either text or XML markup (it's used to tokenize XML), so try example text like '<div id="123">abc' or 'abc<?xml target?>'.
The JavaScript form of the regex follows:
[^<]+|<(!(--([^-]-([^-][^-]-)->?)?|\[CDATA\[([^]]]([^]]+])]+([^]>][^]]]([^]]+])]+)>)?|DOCTYPE([ \n\t\r]+([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])|"[^"]"|'[^']'))([ \n\t\r]+)?(\[(<(!(--[^-]-([^-][^-]-)->|[^-]([^]"'><]+|"[^"]"|'[^']')>)|\?([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])(\?>|[\n\r\t ][^?]\?+([^>?][^?]\?+)>))|%([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F]);|[ \n\t\r]+)]([ \n\t\r]+)?)?>?)?)?|\?(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])(\?>|[\n\r\t ][^?]\?+([^>?][^?]\?+)>)?)?|/(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+)?>?)?|(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+)?=([ \n\t\r]+)?("[^<"]"|'[^<']'))*([ \n\t\r]+)?/?>?)?)
- tsergiu 14y agoThe permalinking is very rudimentary and was put up quickly so that it worked for "most cases". I wanted to focus on building the actual debugger. This will be fixed in the near future.
- bengotow 14y agoOp, have demonstrated your expertise. Nicely done. Thanks jdnier for the example.
- habosa 14y agoWow. How the hell do you (OP) get it to render so fast? That was instantaneous as far as I could tell. I've seen websites take 5x as long to add a <li> to a <ul> ... I'm really amazed.
- tsergiu 14y agoHeh, your browser does most of the hard stuff :) I'm not quite sure what others are doing that it's slow.
- randlet 14y agoYou're not kidding; it is virtually instantaneous in Chrome, IE9 & Firefox.
- nwh 14y agoI'm stunned. I was expecting it to chug with something like that, but nope, instant.
- mambodog 14y agoPerhaps it has something to do with using SVG rather than just HTML elements?
- girvo 14y agoEven on my AMD E-450 netbook, that was pretty much instant. Lagged a lot afterwards (to be expected, running FF on elementary Luna), but way better than I thought it would! Well done OP, seriously well done.