[Programming language] regular expressions quick start

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

A regular expression is a logical formula of strings (including ordinary characters (e.g., letters), and special characters between a to z (referred to as "meta character")) operation, is to use pre-defined specific character and the combination of specific characters, consisting of a "rule string", this "rule string" is used to express a filtering logic of the string. Regular expression is a text mode, mode describes when one or more of the search text string to be matched. Many programming languages ​​support regular expressions for string operations. For example, in Perl built on a powerful regular expression engine. Regular Expressions concept was originally developed by the Unix tools (such as sed and grep) of popularity. Regular expressions are usually abbreviated to "regex", the singular has regexp, regex, the complex has regexps, regexes, regexen. In the real work on the scene, the regular expression is often used for input validation, content retrieval, string replacement work. Personally think that one of the regular expression compulsory programmers should be considered, because of its applications is very broad, and basically can be used in a variety of languages, more important is the flexibility to use Linux or Unix systems regular expressions It can greatly improve efficiency, so learning it is very preservation.

Regular expressions details: regular expression Getting Started Tutorial

Regular expression regular expression engine:

For intuitive regular expression is responsible for a string of regular expression syntax, which is responsible for handling program this expression, it is the regular expression engine. Expression engine provided by the language or the environment, as developers do not directly confront it. We only need to write expressions, and then to the expression engine to process it. Different language or environment will be used in different ways for us to provide support for regular expressions, Take the Java language, we can use regular expressions directly in String.replaceAll () / String.split () / String.matches on () , or java.util.regex class provided by the package to a regular expression.

Being different environments written expression and support more or less there will be some differences, but that you can totally do not need to be careful, because this does not affect you use regular expressions, expressions of modern engines are very similar. Perl 5 types of engines should be considered the most widely used engine.

Features:

Flexibility, logic and functionality is very strong;

You can quickly reach a very complex control character string using simple manner.

For people who are new, more difficult to understand.

Hours list:

Regular Expressions - Tutorial

Regular Expressions - Introduction

Regular Expressions - Syntax

Regular Expressions - metacharacters

Regular Expressions - operator precedence

Regular Expressions - matching rules

Regular Expressions - Examples

Regular Expressions - Common expressions

More quality technical courses:

Ali cloud university's official website ( Ali Cloud University - Official website, creative talents under a cloud ecology workshop )

Reproduced in: https: //www.jianshu.com/p/513f3e712e55

Guess you like

Origin blog.csdn.net/weixin_34206899/article/details/91275176