The Turbo Pascal editor allows Ctrl-A to stand for any single character.
The Unix utilities grep, ed, vi, sed, awk, emacs etc., all support a particular type of pattern.
This is also available from C using the regexp or regex libraries, and is available in some other languages such as tcl. Perl is commonly used for CGI programs and makes heavy use of regular expressions.
Because the utilities grep and sed are often used in Unix shell programs it is worth looking at their pattern mechanism.
The simplest patterns are
^The$
matches ``The'' on a line by itself.
[Tt]he
matches ``The'' or ``the''
[0-9]*
matches any number
ss[89][0-9]*
matches ss student ids
-rw-r--r-- 1 jan 2048 Jul 4 file1To just extract the permissions part, use
ls -l | sed 's/ .*//'
More complicated patterns are
^\([^.]*\)\.\(.*\)$Then the same patterns reversed are
\2\1
For example, to change ``John.Smith'' to ``Smith, John'':
echo "John.Smith" | sed 's/^\([^.]*\)\.\(.*\)$/\2, \1/'