So What Exactly Is a Regular Expression?
Now that you know what regular expressions are used for, a definition is in order. Simply put, regular expressions are strings that are used to match and manipulate text. Regular expressions are created using the regular expression language, a specialized language designed to do everything that was just discussed and more. Like any language, regular expressions have a special syntax and instructions that you must learn, and that is what this book will teach you.
The regular expression language is not a full programming language. It is usually not even an actual program or utility that you can install and use. More often than not, regular expressions are minilanguages built in to other languages or products. The good news is that just about any decent language or tool these days supports regular expressions. The bad news is that the regular expression language itself is not going to look anything like the language or tool you are using them with. The regular expression language is a language unto itself – and not the most intuitive or obvious language at that.
Regular expressions originated from research in the 1950s in the field of mathematics. Years later, the principles and ideas derived from this early work made their way into the Unix world into the Perl language and utilities such as grep. For many years, regular expressions (used in the scenarios previously described) were the exclusive domain of the Unix community, but this has changed, and now regular expressions are supported in a variety of forms on just about every computing platform.
To put all this into perspective, the following are all valid regular expressions (and all will make sense shortly):
Www. forta. com
It is important to note that syntax is the easiest part of mastering regular expressions. The real challenge, however, is learning how to apply that syntax, how to dissect problems into solvable regex solutions. That is something that cannot be taught by simply reading a book, but like any language, mastery comes with practice.