![regular expression not match perl examples regular expression not match perl examples](https://community.intersystems.com/sites/default/files/inline/images/perl.png)
![regular expression not match perl examples regular expression not match perl examples](https://files.realpython.com/media/Regular-Expressions-Regexes-in-Python-Part-1_Watermarked_1.ffa77de784ec.jpg)
A pair of square brackets will translate to any single character contained within. This will match only the words "text" and "Text", but not for example "next". Now what if you need to match a given set of characters, rather than any character in place of the period? Regular expressions provides a means of doing this through using square brackets. If you wanted to match only four letter strings ending in "ext" then you could combine these two like so: Similiarly the "$" character matches the end of the string: The "^" character matches the start of the string, so: We can restrict the position in which the match can occur by using anchors. This expression is not perfect, however, since it will also match parts of longer words which contain "ext", such as "dextrous" and "flextime". For this we use the special character ".", a period in a regular expression tells Perl to match any single character in its place. Take the example of needing to find four letter words that end in "ext". This is, of course, just a taste of what regular expressions can do. This is the most basic kind of regular expression, where each character is matched literally. Will be true only if the string in the variable "$string" contains the substring "text". The match operation returns true if the pattern is found in the string. Let's start with the simplest regular expression operation: the match. In this primer we'll give you a quick run down on how you can use regular expressions in your own programs to give you more power over searching and substituting text. Perl has long been an extremely popular choice for text processing due to its native regular expression support.