Contents | Up | Prev | Next |
Regular expressions are one of the most powerful features of Perl, but are also one of those that beginners find most difficult to understand. Don't let that fact discourage you: they are definitely worth your time.
Basically, a regular expression tells the interpreter to search a string for a pattern. The pattern can be a simple one like the word "hello" or a complex one, such as the word "hello" followed by any number of instances of the word "one", followed by the word "triple". The latter will be written as hello(?:one)*triple inside a regular expression.
The perl operators allow you to do three things with a regular expression:
Some perl functions such as split and grep (which will be covered later) can utilise regular expressions to do other tasks.
Contents | Up | Prev | Next |
Written by Shlomi Fish