<html>
<head>
<title>Movie Search Help</title>
<!-- <link rel=stylesheet type="text/css" href="movies.css"> -->
</head>
<body>
<center>
<p>
<a href=javascript:window.close()>Close</a><br>
<table border=1 width=98% cellpadding=6 align=center>
<tr><td>
<h2>Some characteristics of extended regular expressions are:</h2>
<p>
<ol>
<li>`<b>.</b>' matches <b>any</b> single character.
<li>A character class `<b>[...]</b>' matches <b>any character within the brackets</b>. <br>For example, `[abc]' matches `a', `b', or `c'. To name a range of characters, use a dash. `[a-z]' matches any lowercase letter, whereas `[0-9]' matches any digit.
<li>`<b>*</b>' matches <b>zero or more instances</b> of the thing preceding it. <br>For example, `x*' matches any number of `x' characters, `[0-9]*' matches any number of digits, and `.*' matches any number of anything.
<li>The pattern matches if it occurs anywhere in the value being tested. (SQL patterns match only if they match the entire value.)
<li>To anchor a pattern so that it must match the <b>beginning or end</b> of the value being tested, use `<b>^</b>' at the beginning or `<b>$</b>' at the end of the pattern.
</ol>
<p>
<b>Examples:</b>
<p>
To find a movie that is 70-99 minutes long:<br>
^[7-9].$ in Time
<p>
For an or statement use <b>|</b>:<br>
america|russia
<p>
To find names beginning with `b', use `^' to match the beginning of the name:
<br>
mysql> SELECT * FROM pet WHERE name REGEXP "^b";
<p>
Prior to MySQL Version 3.23.4, REGEXP is case-sensitive, and the previous query will return no rows. To match either lowercase or uppercase `b', use this query instead:
<br>
mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
<p>
From MySQL 3.23.4 on, to force a REGEXP comparison to be case-sensitive, use the BINARY keyword to make one of the strings a binary string. This query will match only lowercase `b' at the beginning of a name:
<br>
mysql> SELECT * FROM pet WHERE name REGEXP BINARY "^b";
<p>
To find names ending with `fy', use `$' to match the end of the name:
<p>
To find names containing a lowercase or uppercase `w', use this query:
<br>
mysql> SELECT * FROM pet WHERE name REGEXP "w";
<p>
Because a regular expression pattern matches if it occurs anywhere in the value, it is not necessary in the previous query to put a wildcard on either side of the pattern to get it to match the entire value like it would be if you used a SQL pattern.
<p>
To find names containing exactly five characters, use `^' and `$' to match the beginning and end of the name, and five instances of `.' in between:
<br>
mysql> SELECT * FROM pet WHERE name REGEXP "^.....$";
<p>
You could also write the previous query using the `{n}' ``repeat-n-times'' operator:
<br>
mysql> SELECT * FROM pet WHERE name REGEXP "^.{5}$";
<br><br><br>
<a href=http://www.mysql.com/documentation/ target=_blank>(Source: http://www.mysql.com/documentation/)</a>
</td></tr>
</table>
<p>
<a href=javascript:window.close()>Close</a><br>
</center>
</body>
</html>