Difference between revisions of "Regular Expression Examples"
From TekiWiki
m (1 revision imported) |
|
(No difference)
| |
Latest revision as of 08:51, 25 March 2016
Regular Expressions are very powerful and quite complex tasks can be achieved with just a few characters. The following example Regular Expressions are simple, frequently used expressions that can be adapted for your own purposes:
Finding Blank Lines
This finds lines that only have spaces! tabs or nothing at all in them:
^[\t ]*$
Finding Trailing Spaces
This finds spaces at the end of the line (note that there is a space at the beginning of the expression):
+$
Lines that Contain Only Digits
This finds lines that have at least one digit and the whole line contains nothing but digits:
^[0-9]+$