Info

Visualize Regular Expressions with Marbles

Visualize Regular Expressions with Marbles

If you are one of those people who visualize things physically better than in the abstract, then Regex Marble Run by [bottomless] might be for you. Visualize Regular Expressions with Marbles. You enter a test expression and a string, and the site generates a virtual marble machine that lets you see the regular expression pick apart the string in a physical way.

Click this link, and youโ€™ll see the regular expression โ€œ^[hH]ack.[dD][^0-9]*$โ€ which, if you arenโ€™t a regular expression user, might seem a bit cryptic. It is fairly simple if you take it bit-by-bit. The caret character tells it to match the start of the string.

So โ€œ^dogโ€ will match โ€œdogโ€ and โ€œdog foodโ€ but wonโ€™t match โ€œfood for a dog.โ€ The following bit โ€œ[hH]โ€ will match either โ€œhโ€ or โ€œHโ€. Then there is โ€œackโ€ which is just what you think it is. So a string starting with โ€œhackโ€ or โ€œHackโ€ might match (depending on the rest of the expression.


Discover more from ChuckysCarnage

Subscribe to get the latest posts sent to your email.

Leave a Reply