Shortcoming--The regular expression of the exercise device

Source: Internet
Author: User
Regular expressions are widely used, but mastering them is not an easy task. To this end, I have written this practice device to help learn.
Please advise more!
Copy the following code to regexp.htm **********
<HTML>
<HEAD>
<TITLE> Regular Expression Practitioners </TITLE>
<meta name = Anhui Chizhou Bureau of Statistics Xu Zuning e-mail:czjsz@stats.gov.cn>
<script language= "JavaScript" >
function OnMove () {
Window.status = "(" +window.event.clientx+ "," +window.event.clienty+ ")" + "::" +document.location
}
</script>
<script language= "JavaScript1.2" >
var re = new RegExp ()//Create regular Expression object
var nextpoint = 0//offset at match
Set Regular expression
function Setpattern (form) {
var mode
if (form.chkmode.checked) mode = "GI"//i: no case g: Overall, it doesn't seem to work.
else mode = "G"
Re.compile (Form.regexp.value,mode)
Nextpoint = 0
Form.reglist.value = ""
}
Check if there is a match
function Findit (form) {
Setpattern (Form)
var input = Form.main.value
if (Input.search (re)!=-1) {
Form.output[0].checked = True
} else {
Form.output[1].checked = True
}
}
Check for matching locations
function Locateit (form) {
Setpattern (Form)
var input = Form.main.value
Form.offset.value = Input.search (re)
}
Check for all matching cases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.