Regular Expression Alternation
From rule number 2 and rule number 3 we can define paradigms — a number of possible patterns. This means that we add two or more languages by applying the set operator union to them. The union of the...
View ArticleThe Kleene Star operator
All finite languages can be described by regular expressions. You can simply list the strings as an alternation string1|string2|string3 etc. But there are also some languages with an infinite number...
View ArticleRegular Expression Precedence
You might be tempted to read the following regular expression as third or fifth row: 'fifth row'.match /third|fifth row/ #=> #<MatchData "fifth row"> 'third row'.match /third|fifth row/...
View ArticleSimple Regular Expression Examples
Now, we have three operators and a small framework. After all this theory, you might wonder if it’s possible for us to solve any problems. Yes, of course we can. Here are some examples: All binary...
View ArticleFrom Regular Expression to Finite Automaton
For each regular expression — and I mean the three operators and the six recursive rules style — there is a finite automaton that accepts exactly the same strings. Since this is not a university book...
View ArticleThe Scent of Regex Requisite
Did you know that the famous quote “Some people, when confronted with a problem, think: I know, I’ll use regular expressions. Now they have two problems.” dates all the way back to 1997? However, most...
View ArticleHTML5 Form Validation With Regex
Client side validation has always been a potential headache for front-end programmers. Embedded blocks with a mixture of imperative JavaScript and declarative regex can be a mess. HTML5 has ambition...
View ArticleGive feedback on my Regular Expressions book prototype
I’ve published a prototype of an upcoming illustrated Regular Expressions book here: http://www.staffannoteberg.com/regexbook Any feedback is very very appreciated. What would make this book more...
View ArticleRegular Expressions – a brief history
Regular Expressions is a programming language with which we can specify a set of strings. With the help of two operators and one function, we can be more concise than if we would have to list all the...
View ArticleDot — The Regex Barbapapa
Remember Barbapapa — Annette Tison’s and Talus Taylor’s children’s books and films from the 1970s? The hero was a pink, pear-shaped guy with the ability to take on almost any shape whatsoever. The...
View Article