Regular Expression Examples

From TekiWiki

Jump to: navigation, search

This whole wiki has now moved to http://www.springboardsolutions.com/wiki

Go to this page Regular Expression Examples

(Created page with "==Finding Blank Lines== This finds lines that only have spaces! tabs or nothing at all in them: <pre> ^[\t ]*$ </pre> ==Finding Trailing Spaces== This finds spaces at the end o...")
 
Line 1: Line 1:
 +
[[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==
==Finding Blank Lines==
This finds lines that only have spaces! tabs or nothing at all in them:
This finds lines that only have spaces! tabs or nothing at all in them:
Line 7: Line 9:
==Finding Trailing Spaces==
==Finding Trailing Spaces==
-
This finds spaces at the end of the line:
+
This finds spaces at the end of the line (note that there is a space at the beginning of the expression):
<pre>
<pre>
  +$
  +$
 +
</pre>
 +
 +
==Lines that Contain Only Digits==
 +
This finds lines that have at least one digit and the whole line contains nothing but digits:
 +
 +
<pre>
 +
^[0-9]+$
</pre>
</pre>

Latest revision as of 07:08, 15 July 2014

Personal tools