HTML and CSS Reference
EXAMPLE 17.13 ( CONTINUED )
document.write("<b>The reg_ex /[A-Za-z0-9_]/ matched the
string\""+ textString +"\".<br />");
A regular expression object, an alphanumeric character in the bracketed character
class [A-Za-z0-9_] is assigned to the variable called reg_expression . This regular
expression matches a string that contains at least one character in the character
class ranging between A and Z , a and z , 0 and 9 , and the underscore character, _.
User input is entered in the prompt dialog box and assigned to the variable text-
String . In this example the user entered Take 5 .
The regular expression test method will return true because this string Take 5 con-
tains at least one alphanumeric character (see Figure 17.14).
Figure 17.14 User entered Take 5 (top). The string contained at least one
alphanumeric character (bottom).
<head><title>The Character Class and Negation</title></head>