Regular expressions can contain
both special and ordinary characters. Most ordinary characters,
like "A", "a", or "0", are the simplest regular expressions; they
match themselves. You can concatenate ordinary characters, so last
matches the string 'last'.
In this example, the
administrator wanted to include shares that started with A
through F including lowercase characters while excluding the admin$
share from the search.
The first expression in this set,
"^[a-fA-F]", starts the search at the beginning of the data
string and searches for shares that start with "a", "b", "c", "d",
"e", "f", "A", "B", "C", "D", "E", or "F". The next expression,
"(?!dmin\$)", looks for the admin share to be excluded since the
"!" character represents a negative match. The final expression, "[
\w\$]*", continues the entire process until the end of line is
reached, or the end of the string is reached, or a white space or
word is encountered.
This example is very similar to
the first example, but includes an additional exclusion. In
this example, the administrator wanted to include shares that
started with A through F including lowercase characters while
excluding the admin$ and C$ share from the search.
The first expression in this set,
"^[a-fA-F]", starts the search at the beginning of the data
string and searches for shares that start with "a", "b", "c", "d",
"e", "f", "A", "B", "C", "D", "E", or "F". The next expression,
"(?!dmin\$)", looks for the admin share to be excluded since the"!"
character represents a negative match. The third expression,
"(?<!c)", searches backward from the current location in the
string for any share starting with "c" and excludes it. The final
expression, "[ \w\$]*", continues the entire process until the end
of line is reached, or the end of the string is reached, or a white
space or word is encountered.