Wildcard and regular expression file

Regular Expressions

Also known as regular expressions. (English: Regular Expression, the code is often abbreviated as regex, regexp or RE), a concept in computer science. Regular expressions are typically used to retrieve, replace the text in line with those of a model (rule) is.

Qualifier

Qualifier is used to specify the regular expression of a given component must appear many times to meet the match. There  *  or  +  or  ?  Or  {n}  or  {n,}  or  {n, m}  total of six kinds.

Regular expressions qualifiers are:

character

description

*

Matches the preceding subexpression zero or more times. For example, zo * matches "z" and "zoo". * Is equivalent to {0}.

+

Matches the preceding subexpression one or more times. For example, 'zo +' will match "zo" and "zoo", but can not match the "z". + Is equivalent to {1}.

?

Matches the preceding subexpression zero or one. For example, "do (es)?" Matches "do", "does" in the "does", "doxy" in the "do". ? Is equivalent to {0,1}.

{n}

n is a nonnegative integer. Matching the determined n times. For example, 'o {2}' does not match the "Bob" in the 'o', but can match the "food" in the two o.

{n,}

n is a nonnegative integer. Matching at least n times. For example, 'o {2,}' does not match the "Bob" in the 'o', but it can match all o "foooood" in. 'O {1,}' is equivalent to 'o +'. 'O {0,}' is equivalent to 'o *'.

{n,m}

m and n are non-negative integers, where n <= m. Match at least n times and match up to m times. For example, "o {1,3}" will match "fooooood" in the previous three o. 'O {0,1}' is equivalent to 'o?'. Please note that no spaces between the comma and the two numbers.

 

Locator

Locator enables you to fix the regular expression to the beginning or end of the line. They also allow you to create such a regular expression, these regular expressions appear in a word, a word at the beginning or end of a word.

Locator used to describe a string or word boundaries, ^  and  $  refer to the beginning and end of the string, \ B  before or after the word boundary description, \ B  represents a non-word boundary.

Regular expressions locator are:

character

description

^

Matches the input string starting position. If the object is set RegExp Multiline property, ^ also matches the position after the \ n or \ r.

$

Matches the position of the input end of the string. If the object is set RegExp Multiline property, also with $ \ n or \ r position before matching.

\b

Matches a word boundary, that is, the position between a word and a space.

\B

Non-word boundary matching.

Note : You can not use qualifier locator. Since the wrap or close to the front or rear of the word boundary can not have more than one location, such as not allowed  ^ *  or the like expression.

To match a line of text at the beginning of the text, please start using the expression in the positive  ^  character. Do not  ^  usage in this use of the expression in parentheses confused.

To match the text at the end of a line of text, see the end of the expressions used in a positive  $  characters.

 

Tsuhaifu

1. First of all we should know the simple understanding of the role wildcard?

 Wildcard and we learned a little bit similar to regular expressions. Is when we have to operate simultaneously on multiple files, we can go through to achieve a wildcard, as these symbols are not words to achieve, but as a string instead of the file name, let's introduce its implementation

2. The first list some common wildcard command:

 

Guess you like

Origin www.cnblogs.com/w520/p/11365413.html