Javascript is a very free language. Everything in Javascript is a variable, including a function.
Basic
Function
(Definition) (parameter 1 [, parameter 2...]) the following code creates a function and runs it.
(Function (str) {alert (str. length) ;}) ('test _ str ');
Http://vc.wz: 80/l.html? Q = 5 & B = 5 # ddd
The first field (separated by space) Below is an attribute of window. location, followed by its value.
Hash # ddd
Host vc. wz: 80
Hostname vc. wz
Href http://vc.wz/l.html? Q = 5
In Javascript, there are two ways to use regular expressions. One is to create an instance of a regular expression, but to use the regular expression related methods in the String object.
Var my_regex =/[a-z] +/g;
Var my_regex = new ("[a-z] +", "g ");
Exec (string), which is used to RegEx the string and returns the matching result.
Test (string) to test whether the string contains matching results
[Edit Regular Expressions in string objects] Regular Expressions in string objects
Match (pattern) performs regular match based on pattern. If it matches, the matching result is returned. If it does not match, null is returned.
Search (pattern) performs regular match based on pattern. If a result is matched, the number of indexes is returned; otherwise,-1 is returned.
Replace (pattern, replacement) performs regular matching based on pattern and replaces the matching result with replacement.
Split (pattern) performs regular segmentation based on pattern and returns a split array.
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.