HTML and CSS Reference
So far, we haven't described anything you couldn't find with a simple literal search. The power of regular
expressions is that you can write strings that match several similar strings. For instance, you can write an
expression that matches any start-tag, not just a particular start-tag. To do this, you need wildcards that can
stand in for more than one character.
The first such wildcard is the period. It matches any single character except a line break. For example, the
regular expression 200. matches 2000 , 2001 , 200Z , 200! , and many more strings. The regular expression
a....b matches any six-character string that begins with a and ends with b , such as abbbbb , aaabbb , aDCEFb ,
ab bc b , and many more. Table A.3 shows more examples.
Table A.3. The Period Wildcard
Any string beginning with Foo, followed by a
single character, followed by Bar, not containing
any line breaks
Any four-character string whose last three letters
Any four-character string not containing any line
Any five-character string not containing any line
breaks whose middle character is the letter c
The only characters the period doesn't match are the carriage return and the line feed. Because HTML does not
usually consider line breaks to be significant and tags can extend across multiple lines, this is problematic.
Some regular-expression dialects, including Perl's, allow you to modify this behavior so that the period does not
match a line break. However, jEdit's does not.
To match any character, including a line break, you can use the character class [.\s] . More on this shortly.