1 Overview
A Regular Expression is a matching pattern that describes the features of a string of texts.
Just as words such as "tall" and "strong" in natural languages abstract to describe the features of things, regular expressions are the high
Today, I want to use a regular expression in Java to obtain any character in a piece of text. Therefore, you can write the following matching rules at will:(.*)After the result is run, the text after the line break cannot be obtained. So I checked
Character/Meaning: For characters, it usually indicates the literal meaning, indicating that the subsequent characters are special characters, not explained.For example:/B/matches the character 'B'. By adding a backslash (/B/) before B, the
test [Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]Match the regular expression of the ftp addressCopy codeThe Code is as follows:Ftp: // (. + ?) /? Is the minimum match, which is the
Copy codeThe Code is as follows:The execution result in IE is truetrue.The execution result in FireFox is truefalse.In the regular expression/gi, g indicates global, And I indicates case-insensitive.Generally, the global attribute is true, and the
The Regular Expression provides an efficient and convenient method for string mode matching. Almost all advanced languages support regular expressions or provide ready-made code libraries for calling. This article describes the application skills of
Test (): determines whether a string matches the specified mode.Exec (): returns an array. The first entry in the array is the first match, and the others are reverse references.Match (): returns an array containing all matching strings.Search ():
This is from yyyy-mm-dd hh: mm: ss./^ (\ D {4}) \-(\ d {2}) \-(\ d {2}) (\ d {2 }) :( \ d {2}) :( \ d {2}) $ /;This is from yyyy-mm-ddde./^ (\ D {4}) \-(\ d {2}) \-(\ d {2}) $/Function validateCNDate (strValue ){Var objRegExp =/^ \ d {4} (\-| \/| \.)
The following code returns: FALSE, TRUE, TRUEWhy is the first result FALSE?String: Mode://The first should beRe = new RegExp ("^ \ d * $ ");\ Escape in quotation marksThe first pair has double quotation marks. The double quotation marks must be
In general, regular expression matching is greedy, for example, the following example:String:... src = "http://www.bloghome.cn/1.mp3" type = "application/x-mplayer2 "....Results of requirements: http://www.bloghome.cn/1.mp3If the matching expression
Regular Expression learning notesThe regular expression describes a string matching pattern, which can be used to check whether a string containsThere are seed strings, replace matched substrings, or retrieve substrings that meet certain conditions
Copy codeThe Code is as follows:'--------------------------------------------------------------'Match object'Matched search results are stored in the Match object, providing access to read-only attributes matching regular expressions.'Match objects
I. Regular Expression OverviewII. Application of Regular Expressions in VBScriptIii. Application of Regular Expressions in VavaScriptIv. ExampleV. SummaryI. Regular Expression OverviewIf you have never used a regular expression, you may not be
How do you test regular expressions? Write the Code directly in a large segment, wait for the program to run there, and then use alert to display the result? Or is it possible to temporarily write a page and discard it after testing?You can try this
CharacterMeaning: For characters, it usually indicates the literal meaning, indicating that the subsequent characters are special characters, not explained.For example:/B/matches the character 'B'. By adding a backslash (/B/) before B, the
Copy codeThe Code is as follows:
Dim param, smiles 'Param is the fully available mark of the UBB label. param = full is fully available. Otherwise, smiles, a label with a large footprint, is not supported.Function UBBCode (content)Dim n, I'On error
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