Pnuts CC's Blog Flower & World, Life & Paradise.

JS Regex Analysis v0.1

Introduce

RegexAnalysis is a tool designed for helping people reading and understanding regex expression. It's written in javascript and tested in IE6~8, FF, Chrome.

Download

Version V0.1

Features

  • Colorize key words
  • Code folding
  • Highly customizable
  • Block Highlight

Manual

Invoke in javascript

The following coding get the DOM as the result of analysis. The arg could be string or regex.

regexAnalysis.getDOM(arg);

For Example :

var regex = /(abc(?:\(|\[)[^w]{0,10}\[\})\)\\/g;
document.body.append(regexAnalysis.getDOM(regex));

Output :

Feature Manual

Move mouse on the color-bar, the block will be highlighted.

image

Click color-bar, the block would be folded. Another click would cancel folding.

image

Customize

You can customize it by modified regexAnalysis.config.

The following is the default config :

	config : {
		// example : [ 
		//	leftwrap [ prefix, color, bgcolor ],
		//	rightwrap [ prefix, color, bgcolor ],
		//	color, bgcolor,
		//	underline [ bgcolor, border-color, border-width, mouse-over-color, height ]
		//  folder [ folder-text, color, bgcolor, bordercolor ] 
		//  folder only be effective when underline is effective.
		// ]
		"paren" : [ 
			[ "(", 0, "skyblue" ], 
			[ ")", 0, "skyblue" ], 
			0, 0,
			[ "skyblue", "blue", "5px", "rgb(255,255,128)", "4px" ], 
			[ "...", 0, "rgb(230, 230, 255)", "gray"] 
		],
		"bracket" : [ 
			[ "[", 0, "lightgreen" ],
			[ "]", 0, "lightgreen" ],
			0, 0,
			[ "lightgreen", "green", "5px", "rgb(255,255,128)", "4px" ],
			[ "...", 0, "rgb(230, 255, 230)" , "gray"]
		],
		"curly" : [
			[ "{", 0, "#FFB7DD" ],
			[ "}", 0, "#FFB7DD" ],
			0, 0,
			[ "#FFB7DD", "#FF3333", "5px", "rgb(255,255,128)", "4px" ],
			[  "...", 0, "rgb(255, 230, 230)", "gray"] 
		],
		"vertical-bar" : [ [ "|", 0, "orange" ],0, 0, 0, 0, 0, 0, ],
		space : "2px"
	},

config is a object as you see, and most of its attributes are array(Except space). Zero represent none.

paren represent ( ) , bracket represent [ ], curly represent { }, vertical-bar represent |

image

Config.space is the space between two color-bars.

Format of each attribute (array) :

[ leftWrap, rightWrap, color, backgroundColor, underline(color-bar), code-folding ]

The color & backgroundColor effect the text IN the wrap. ( Don't contain the wrap itself. )

leftWrap & rightWrap : ( 0 represent no left/right wrap, for example vertical-bar has no wrap )

image

Format of left/right wrap :

[ wrapText, wrapColor,  wrapBackgroundColor ]

underline / color-bar :

image

Underline Format: [ background-color, border-color, width, mouse-over-color, height ]

Coding Folding:

image

Coding Format: [ folding-text, text-color, background-color, border-color ]

License

It's released under three licenses: MIT, BSD, and GPL. You may pick the license that best suits your development needs.


Comments (129) Trackbacks (2)
  1. Hello.This article was extremely remarkable, especially because I was browsing for thoughts on this matter last Wednesday.

  2. Having said that, be careful not to always be impulsive plus
    tempted while using amount there’re willing to provide and attainable scams with all the trade Here is the only spot where items like the maximum or “default” apr,
    the causes of them to improve your account, a dollar amount for
    almost any fees that could be associated with an accounts, and what these are willing to do today to help you with a account
    if you’d like it. Nonetheless, you should check out different loan companies first?

  3. The garden has the towering most to the delicate which is a clamper
    with yellow-striped leaves. The area has numerous upgrade alternatives and also the soldier choices are functional.

    The capture factor additionally has assets such as off board fire encourage which
    could be held for longer durations.

  4. When water is beneath excessive pressure (like it is in an espresso extraction), it is able to dissolve extra carbon dioxide, which is produced in coffee in the
    course of the roasting course of. When the extracted coffee hits the cup, and the liquid comes back to
    a standard pressure, the liquid can’t hold onto all
    of that fuel, so it involves the top in the form
    of small bubbles — which chemicals in the coffee attach to, in flip creating
    the crema.

  5. It’s awesome to pay a quick visit this web page and reading the views of all colleagues regarding this article, while I
    am also keen of getting experience.

  6. Earlier than we started our doc automation efforts, we rigorously evaluated
    the prices and benefits related to document automation.

  7. I think that everything published made a bunch of sense.

    However, consider this, what if you were to write a awesome
    post title? I ain’t suggesting your content isn’t
    solid, however what if you added a post title that makes people desire more?
    I mean JS Regex Analysis v0.1 Pnuts CC’s Blog is kinda vanilla.
    You ought to look at Yahoo’s home page and note
    how they create article titles to get viewers to open the links.
    You might add a video or a picture or two to get people excited
    about what you’ve written. In my opinion, it would make
    your posts a little bit more interesting.

  8. There’s definately a lot to know about tis topic.
    I really like all of the points you’ve made.

  9. Completely, WW1 crushed an excellent many romanticised ideas about conflict and on a large scale too.

  10. Sonuçta Balkanlar’a her zaman ucuz bilet var, her yeri şimdi görmemiz lazım diye uğraşmayın madem yorucu olmadan gezmek istiyorsanız.

  11. This quiz is nice for a lot of situations, such as events,
    social teams, pub quizzes or faculty groups.

  12. That is a excellent tip particularly to individuals fresh
    to the blogosphere. Short but very accurate info
    Thanks a lot for sharing this. Essential read article!

  13. I think everything wrote made a great deal of sense. However,
    what about this? what if you added a little information?
    I am not saying your information is not good., however suppose you added a title that
    makes people want more? I mean JS Regex Analysis v0.1 Pnuts CC’s Blog is a little vanilla.
    You ought to look at Yahoo’s front page and watch how they write post titles to grab people to open the links.
    You might add a related video or a pic or two to get people excited
    about what you’ve written. Just my opinion, it might make your posts a little livelier.

  14. Can I simply say what a comfort to discover somebody that actually knows what
    they’re talking about over the internet. You certainly realize how to bring a
    problem to light and make it important. More people should check this out
    and understand this side of your story. I was surprised you’re not more popular since you surely possess the gift.

  15. Music is first for the home-heads, an obvious reality heard
    in all their originals, remixes and immaculately selected units.

  16. This is the right webpage for everyone who hopes to understand this topic.

    You understand so much its almost tough to argue with you (not that I personally will need toHaHa).

    You definitely put a brand new spin on a subject that has been written about
    for many years. Excellent stuff, just great!

  17. five hundredrevolting disgustingHacernuclear familytwo nuclear familyreformasnuclear
    family five hundrednuclear familyrevolting disgustingintegralesrevolting disgusting twoextended
    familyimplicarevolting disgustingfive hundred twoextended familyplanificarextended familytwo nuclear familyrevolting disgustingconnuclear family nuclear familyrevolting disgustingunrevolting disgusting five hundredtwonuclear familyrevolting disgustingparrevolting disgustingtwo
    five hundrednuclear familyrevolting disgustingdetwofive hundred twoextended familyrevolting disgustingmesesrevolting disgustingnuclear familyfive
    hundred five hundredtwonuclear familyrevolting disgustingdeextended familytwofive
    hundred antelaciónextended family, five hundredtworevolting disgustingteniendonuclear familytwofive hundred enrevolting disgustingextended familytwo tworevolting disgustingcuentarevolting disgustingnuclear familytwo tworevolting disgustingdetwofive hundred five hundrednuclear familyrevolting disgustingquetwo twonuclear familyestamosnuclear
    familytwofive hundred tworevolting disgustinghablandorevolting disgustingfive hundred five hundrednuclear
    familyrevolting disgustingderevolting disgusting five hundredtwoextended
    familydarle five hundredextended familyrevolting disgustingunrevolting disgustingextended familyfive hundred twonuclear familyrevolting disgustinggirorevolting disgustingextended familytwo derevolting disgustingextended familytwo five hundrednuclear family180ºtwofive
    hundred five hundrednuclear familyarevolting disgustingnuclear familyfive hundred twonuclear familyrevolting
    disgustingturevolting disgustingnuclear familyfive hundred five hundredextended familyviviendarevolting disgustingtwofive hundred.

  18. Im not too a good deal of online reader to tell the truth however, your sites great, keep it up!
    I’ll go ahead and bookmark your site to come back later.
    Thanks a lot

  19. Visit for Rajdhani day, Rajdhani Night, Milan Day, Milan Night, Mumbai Result, kalyan Game and Only
    web site that present assured satta matka game to its customer.

  20. Makіng money onlinne uzed tⲟ juѕt аbout require уоu to have ʏour own personal site, items
    tⲟ sell and some marketing savvy.

  21. You should buy on-line quite a lot of private care merchandise, which embody female hygiene items
    like sanitary napkins, tampons, maternity pads
    and underpads, hair removing creams from Anne French, Fem, Veet and bikini trimmers & shavers from Philips.

  22. I wish faculties in my native space would see the connection between music and learning, my kids usually come home from college saying this and
    that was boring.

  23. We offer free proofs throughout the creation process, present one-on-one customer support,
    and offer bobbleheads in portions of 1 to 1 million!

  24. French warplanes and a US Predator drone on Thursday morning attacked a giant convoy of more than 100 four-wheel drive vehicles fleeing west out of Muammar Qaddafi’s hometown of Sirte.

  25. I want to to thank you for this good read!! I absolutely
    enjoyed every small amount of it. I’ve got you book-marked to consider
    new stuff you post

  26. Most recycling and trash removing providers provide their business to the residential market as well as for waste
    management, I was stunned to seek out poop elimination service added to the record,
    and you might be most likely aware of rubbish disposal repair.

  27. Most individuals in the 80s got style pattern ideas from TELEVISION reveals like:
    Different Strokes, Dynasty, Silver Spoons, Miami Vice, Household Ties,
    The Facts of Life, etc.

  28. If you want to set up a fantastic auto business or anything that has to do with people,
    you need to come out clear from the get go. Do not sale rubbish to people of us.

  29. Amazing issues here. I’m very happy to look your article.
    Thanks a lot and I am taking a look ahead to contact you.
    Will you please drop me a mail?

  30. Van Loon says it is up to parents to make sure kids haven’t got entry to jewellery intended for adults.


Leave a comment