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

Popular posts from this blog

Hackaday Links: May 31, 2020

Modern Radio Receiver Architecture: From Regenerative to Direct Conversion

Homebrew 68K Micro-ATX Computer Runs Its Own OS