Some Pattern Examples

Match the string "hello" anywhere on a line:

/hello/

Match the string "hello" at the start of a line:

/^hello/

Match the string "hello" at the end of a line:

/hello$/

Match a line containing only the string "hello":

/^hello$/

Match all trailing blanks (including zero) on a line:

/  *$/

Match all characters (including zero) on a line:

/^.*$/

Match a number like "3", "862", etc:

/[0-9][0-9]*/

Match a C language identifier:

/[a-z_][a-z_0-9]*/

Match a digit in column ten:

/@(10)[0-9]/

Match an empty line:

/^^$/

Match a line containing only blanks:

/^^*$/

Match a line starting with a period followed by a name (such as a command in the QNX2 DOC markup language):

/^\.[a-z][a-z]*/