In simple terms, regular expressions are a powerful tool for pattern matching and replacement. The function is as follows: test a mode of a string. For example, you can test an input string to see if there is a phone number or a credit card number. This is called Data Validity verification.
Detailed explanation of Regular Expressions
Introduction
In short, regular
Today in the change of a business-to-business e-commerce system, found that the ASP is positive, although using ASP for a long time, but never used regular expression, this system has a regular function is very good, I see it.
Copy Code code as follows:
Function regexptest (PATRN, STRNG)
Dim regEx, Match, matches ' Set variable.
Set regEx = New RegExp ' establishes a
Definitions and Usage The replace () method replaces some characters in a string with some other characters, or replaces a substring that matches a regular expression. Grammar Stringobject.replace (regexp,replacement) Parameter descriptionRegExp required. The RegExp object that sets the pattern to be replaced. Note that if the value is a string, it is used as the direct text pattern to retrieve, not first converted to the RegExp object.Replacement
The problem is this, some case to give: Http://jb51.net?a=1
This type of URL address append parameter changes to: http://jb51.net?a=1b=2
But how do you know that you already have the same parameter name, for example: http://jb51.net?a=1a=2
This is not a big mistake, but the address bar looks bad. What about it? With the regular solution bar (originally I want to use PHP string processing solution, but later felt to learn the
The main reference to the bibliography tutorial
String.match ()
The match () method retrieves the target string to find one or more text that matches the regular expression RegExp. match () has two kinds of situations
:
1, if regexp has a flag G, match () Method performs a global search and finds all matching substrings in the target string.
match
return value
JS Regular expression//checksum is all composed of numbers function isdigit (s) {var patrn=/^[0-9]{1,20}$/; if (!patrn.exec (s)) return false return True}//Checksum Login Name: You can only enter 5-20 letters beginning with a letter, with numbers, "_", "." The string Java code function Isregisterusername (s) {var patrn=/^[a-za-z]{1} ([a-za-z0-9]|[. _]) {4,19}$/; if (!patrn.exec (s)) return false return True}//Verify user name: You can enter only 1-30
First letter case Independent mode
There was a time when I wrote regular expressions to match drug keywords and often wrote expressions like/viagra|cialis|anti-ed/. In order to make it more beautiful, I would sort the keywords, and in order to speed up, I would use/[vv]iagra/instead of/viagra/i, just to make the necessary parts for the case-and-write mode. To be exact, I need a case-insensitive match for the first letter of each word.
I wrote a funct
Look here. If you are familiar with regular expressions
, let's get to the point. The name of this tool is called regular Expression exploration. You can download it from here. The current version is 1.0 release. Rex is a command line tool,
Specific use can be executed under CMD can see the usage, this is. NET program. We can reference it and then use the code below to generate the string array we want.
The first method:
In the user registration page Some requirements are more stringent, need to verify the identity card JS is legitimate, through this function strictly this system software, thus filtering to many water passengers. Here's how to achieve this method for you to explain.
Most of the time we are using a set of regular expressions to determine whether the user entered the identity card is legitimate, that in the
This will be the end of this series, the last article. In contrast, embedding conditions are rarely used in regular expressions, and even many languages do not support embedding conditions, but most of all, this chapter briefly describes how embedded conditions are used in regular expressions. An expression that embeds a condition follows the instructions in the book:
? (backer-ference) True-regex|fal
Regular expression in PHP: a summary of regular expression processing functions (preg_match, preg_match_all, preg_replace, pr. We have learned the basic syntax of regular expressions, including delimiters, atoms, metacharacters, and pattern modifiers. In fact, to work with a regular expression, you must use the basic s
Ip address Regular Expression matching method, ip address Regular Expression matching
A Regular Expression (Regular Expression) is a concept in computer science. Regular Expressions use a single string to describe and match a series of strings that conform to a certain synta
ArticleDirectory
1 Overview
2 Basic Applications
3. Extended applications
1 Overview
When you are a beginner at regular expressions, you are not familiar with the RegEx class. If you encounter any problems, you do not know which method to use. This article introduces the basic applications of the RegEx Class Based on some typical application scenarios of regular expressions. Here we will
Python Regular Expression guide, python Regular Expression1. Regular Expression basics 1.1. Brief Introduction
Regular expressions are not part of Python. Regular Expressions are powerful tools used to process strings. They have their own unique syntax and an independent pro
Data validation is an important step for network applications to accept data from the client, after all, you need to ensure that they conform to the expected format before using customer data. In Web applications, you can choose to use specific platform tools such as ASP.net, JSPs, and so on, or you can take advantage of client JavaScript, which can simplify data validation by using regular expressions in JavaScript.
PHP regular expression syntax reprinted from: http://blog.csdn.net/kkobebryant/article/details/267527
Basic regular expression syntax
First, let's take a look at two special characters: '^' and '$'. they are used to match the start and end of the string, respectively.
"^ The": matches strings starting with ";"Of despair $": match the string ending with "of despair;"^ Abc $": matches strings starting wit
Reprinted from: http://blog.csdn.net/kkobebryant/article/details/267527
Basic syntax for regular expressions
First, let's take a look at two special characters: ' ^ ' and ' $ ' they are used to match the beginning and end of the string, respectively, to illustrate
"^the": matches a string that begins with "the";"Of despair$": matches a string ending with "of despair";"^abc$": matches a string starting with ABC and ending with ABC, in fact only ABC
PHP regular expression full manual, regular expression full manual
Php regular expression full manual
Preface
Regular Expressions are cumbersome, but they are powerful. The application after learning will give you an absolute sense of accomplishment in addition to improving your efficiency. As long as you carefully rea
the basic learning of regular objects and regular expressionsA regular expression is a word-matching tool that is more like a text template, as long as the qualifying results are filtered out.The regular expression is used, and it relies on the methods and properties provided by the
use a formal language to describe the rules so that computers can automatically process them.Regular ExpressionIs an ideal choice.
In daily programming, we may be familiar with regular expressions to match strings. But I want to introduce it again from the most basic concepts of regular expressions, mainly to give you a deeper understanding of it. First, we need to redefine the concept of "language. "Lang
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.