DIY Regular Expressions
In the Star Wars universe, not everyone uses a lightsabe, and those who do wield them had to build them themselves. Thereās something to be said about that strategy. Building a car or a radio is a great way to learn how those things work. Thatās what [Low Level JavaScript] points out about regular expressions. Sure, a lot of people think they are scary. So why not write your own regular expression parser and engine? Get that under your belt and youāll probably never fear another regular expression.
Of course, most of us probably wonāt do it ourselves, but you can still watch the process in the video below. The code is surprisingly short, but donāt expect all the bells and whistles you might find in Python or even Perl.
In the hands of the skilled, regular expressions are very powerful and offer a quick way to split apart text data. Like a lot of powerful ideas, the basic concept ā that of a finite state machine ā is really simple. It is the application to real problems that becomes difficult.
If you want a primer on regular expressions that doesnāt require you to write your own tools, we have had a few posts that can help. If you just want some practice, try a crossword puzzle.
from Blog ā Hackaday https://ift.tt/2HMInmJ
Comments
Post a Comment