Beruflich Dokumente
Kultur Dokumente
Character classes provide you with a way to restrict the characters you are searching for to a certain set by
wrapping those characters in brackets.
Character Matches Example
[abc] Any one of the characters enclosed in the brackets. [e-g] matches "e" in "bed", "f" in "folly",
Specify a range of characters with a hyphen (for and "g" in "guard"
example, [a-f] is equivalent to [abcdef]).
[^abc] Any character not enclosed in the brackets. Specify [^aeiou] initially matches "r" in "orange",
a range of characters with a hyphen (for example, "b" in "book", and "k" in "eek!"
[^a-f] is equivalent to [^abcdef]).
\b A word boundary (such as a space or carriage \bb matches "b" in "book" but nothing in
return). "goober" or "snob"
\B Anything other than a word boundary. \Bb matches "b" in "goober" but nothing in
"book"
\d Any digit character. Equivalent to [0-9]. \d matches "3" in "C3PO" and "2" in
"apartment 2G"
\D Any nondigit character. Equivalent to [^0-9]. \D matches "S" in "900S" and "Q" in "Q45"
\w Any alphanumeric character, including underscore. b\w* matches "barking" in "the barking
Equivalent to [A-Za-z0-9_]. dog" and both "big" and "black" in "the big
black dog"
\W Any non-alphanumeric character. Equivalent to [^A- \W matches "&" in "Jake&Mattie" and "%"
Za-z0-9_]. in "100%"
\s Any single white-space character, including space, \sbook matches "book" in "blue book" but
tab, form feed, or line feed. nothing in "notebook"
\S Any single non“white-space character. \Sbook matches "book" in "notebook" but
nothing in "blue book"
\f A form feed character. --
\n A line feed character. --
\r A carriage return character.
Note: Dreamweaver MX 2004 contains a bug in its regular expression engine where carriage return characters (\r)
are not recognized when you click the Find Next button. However, clicking the Find All button does reveal these
characters.
\t A tab character. --
Regular Expression with DreamWeaver
JavaScript
There are two ways of creating a regex in JavaScript: using literal syntax or the RegExp() constructor.
The forward slashes are delimiters indicating that everything between them should be treated as a regex. If
the regex needs to match a literal forward slash, escape it with a backslash. For example, the regex for a
CSS comment needs to be rewritten like this:
var css_comment = /\/\*.*\*\//;
When using literal syntax, add the flag(s) after the closing delimiter like this:
var css_comment = /\/\*.*\*\//gm;
When using the RegExp() constructor, pass the flags in a string as the second argument like this:
var css_comment = new RegExp("/\\*.*\\*/", "gm");