JavaScript Tutorial/Regular Expressions/Match
Содержание
- 1 Match: [aA]
- 2 Match: AAA|BBB
- 3 Match: [A-Z][0-9]
- 4 Matching a single literal character(It can be either a lower or upper case character)
- 5 Matching sequences of more than one literal character (The format is two upper case letters, a dash and three numbers)
- 6 Regular Expressions: /a/
- 7 Regular Expression Tester Form
- 8 To match "b{0,1}rea{0,1}d"
- 9 To match words bread, read, or red
Match: [aA]
<source lang="javascript">
<html> <head> <title>Matching a single literal character</title> <script type="text/javascript" language="javascript">
</script> </head> <body> <form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html></source>
Match: AAA|BBB
<source lang="javascript">
<html> <head> <script type="text/javascript" language="javascript">
</script> </head> <body> <form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html></source>
Match: [A-Z][0-9]
<source lang="javascript">
<html> <head> <title>Matching a sequence of literal characters</title> <script type="text/javascript" language="javascript">
</script> </head> <body> <form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html></source>
Matching a single literal character(It can be either a lower or upper case character)
<source lang="javascript">
<html> <head> <title>Matching a single literal character(It can be either a lower or upper case character) </title> <script type="text/javascript" language="javascript">
</script> </head> <body>
This page allows you to guess a single literal character of either case
<form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html></source>
Matching sequences of more than one literal character (The format is two upper case letters, a dash and three numbers)
<source lang="javascript">
<html> <head> <title>Matching sequences of more than one literal character (The format is two upper case letters, a dash and three numbers)</title> <script type="text/javascript" language="javascript">
</script> </head> <body>
This page allows you to choose a six character parts code
<form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html></source>
Regular Expressions: /a/
<source lang="javascript">
<html> <head> <title>Matching a single literal character</title> <script type="text/javascript" language="javascript">
</script> </head> <body> <form> <button type="Button" onclick="TestGuess()">Click here to guess</button> </form> </body> </html></source>
Regular Expression Tester Form
<source lang="javascript">
<html> <head> <title>Regular Expression Tester</title> <script type="text/javascript" language="javascript">
</script> </head> <body>
This page allows you to create and test regular expression patterns
<form name="SimpleForm">
Enter a pattern: | <input name="FirstInput" type="text"> |
Enter a string to match the pattern: | <input name="TestInput" type="text"> |
<button type="Button" onclick="ClearAndSet()"> Clear and Start again</button> | <button type="Button" onclick="TestString()"> Click to test the string you entered</button> |
</form> </body> </html></source>
To match "b{0,1}rea{0,1}d"
<source lang="javascript">
<html> <SCRIPT LANGUAGE="JavaScript">
</SCRIPT> </html></source>
To match words bread, read, or red
<source lang="javascript">
<html> <SCRIPT LANGUAGE="JavaScript">
</SCRIPT> </html></source>