1,linux The difference between the shell regular expression * and the + numberExample Memory:[email protected] data]# Touch test.txt[Email protected] data]# cat>>test.txt> Gooood> Goood> Good> God> GD> EOF* indicates repeating the preceding character 0 or more times[[email protected] data]# grep "Go*d" test.txtGoooodGo
First, the concept and characteristics of regular expressions:A regular expression is a logical formula for a string operation, which is to make a "rule string" with a predefined set of characters and a combination of those specific characters.This "rule string" is used to express a filtering logic for a string. Specify some special syntax to represent character
you want to edit the text: Start vim, enter command mode, press I, switch to input mode.Command mode has only some of the most basic commands, so you still have to rely on the bottom line command mode to enter more commands.Input modePress I in command mode to enter the input mode.In input mode, you can use the following keys:
character keys and shift combinations , enter characters
Enter, enter, line break
Back SPACE, backspace key, delete the previous charact
Tags: regular expressionsLong time have not updated blog, Hope not forget beginner's mind 51CTO find the original happy memories!Classification of regular expressions
Basic Regular Expressions (basic Regular expression also known as basic RegEx abbreviation Bres)
Three minutes to learn about regular expressions in the grep command
In Linux and Unix-like operating systems, how does one use the grep command with a regular expression?
Linux provide
Do not accumulate kuibu to thousands of miles, do not accumulate small flow into Jianghai--Xun Zi "an exhortation chapter"Whether you look at a Linux book or a video tutorial, it is important to say that regular expressions can help manage the system by using regular expressions correctly. In fact, a regular
repeats at least n times, even more times.S{n,m} s repeats at least n times and repeats at most m times.POSIX-defined character classifications:[: Alnum:] Alphanumeric characters.Match range is [a-za-z0-9][: Alpha:] Alphabetic characters.Match range is [a-za-z][: Blank:] Space or tab characters.Match range is space and TAB key[: Cntrl:] Control characters.Match control keys such as ^m to press CTRL + V and press ENTER to output[:d Igit:] Numeric characters.Match all numbers [0-9][: Graph:] Char
Document directory
Unzip the tar command in Linux
Find-name 'xixi. php' | xargs Perl-pi-E's | Hello | AA | G'
Find-name '*. html' | xargs Perl-pi-E's | AA | Hello | G'
Find-name '*. HTML '| xargs Perl-pi-E's | | G' (Note: It seems that only one row can be matched)
In Linux, this method is used to replace a large number of files with Trojans (JS files.
Search for the ABC. cpp file from the root direc
Delete Line 2ndNl/etc/passwd|sed ' 2d '
Delete Line 3rd to last rowNl/etc/passwd|sed ' 3, $d '
Add a string after line 2nd drink teaNl/etc/passwd|sed ' 2a drink tea '
Add string drink tea before line 2ndnl/etc/passwd|sed ' 2i drink tea '
Add two lines of content after line 2nd drink tea? Drink beer?Nl/etc/passwd|sed ' 2a drink tea?\ enter drink beer? '
Replace 2~5 line 2-5Nl/etc/passwd|sed ' 2,5c This was line 2-5 '
List Line 5th to 7thNl/etc/passwd|sed- n ' 5,7p '
Intercepting nat
Starting from the Linux learning process to detect the effect of learning, students recommend two regular expressions of the topic. These two topics are not many words, but it has triggered a piece of my thinking. operating Environment CentOS6.7 2.6.32-573.22.1.el6.x86_64Now the title is organized as follows:"The first "Use a regular
:]
Any one hexadecimal number (i.e.: 0-9,a-f,a-f)
[[: xdigit:]]+
[: Cntrl:]
Any one control character (the first 32 characters in the ASCII character set)
[[: Cntrl:]]
[:p rint:]
Any one of the characters that can be printed
[[:p rint:]]
MetacharactersMetacharacters (meta character) is a Perl-style regular expression that is supported by onl
First, IntroductionIntroduction two names in the Linux system:grep,egrep. To use these 2 commands first learn to use regular expressions, before you introduce regular expressions, let's say that everyone is familiar with the wildcard characters used in Word, namely:*: Denotes any character of any length. ? : Represents any single character.Remembering the meaning
1. Fuzzy matching is full-text matching;A regular expression is a keyword match that contains^ Opening$ end^$ Empty Line. Any one character\ Invert Righteousness* Repeat 0 to several times before one character. * Any number of characters? Preceded by a character with or without\{m,n\} The characters in front of repeat M to n times egrep or sed-r can be removed \[a-c|0-9] A,b,c or a number[^ABC] [] Other tha
Grep, egrep, and regular expressions
All files in Linux: text files are critical and commonly used for text file search.
Linux text search tools: grep, egrep, fgrep, and text search are used to search text files.
File name search is a bash feature in
Linux regular expression features and similarities and differences between BRE and ERE, breere
Linux Regular Expressions (Regular expressions) Comply with posix bre or posix ere standards. What is POSIX? POSIX Portable Operating S
for people who are just touching, regular expression learning and using a painful and confusing thing, but as long as there is enthusiasm, will find very interesting. Then please let us play the spirit, come up with their own interests and passion into the wonderful world of Linux. What is a regular
Regular ExpressionsEdit regular expressions, also known as formal representations, general representations (English: Regular Expression, often abbreviated as regex, RegExp, or re) in code, a concept of computer science. A regular express
Linux regular expression-backslash
The metacharacter backslash (\) converts a metacharacter to a common character (and converts a common character to a metacharacter ). It forcibly interprets any metacharacters as common text to match the character itself. For example, a period (.) is a metacharacter. to match a period, you must use a backslash to escape it. The
Basic Regular Expressions (Regular expression)
match any character
\{n,\}
match previous character repeat at least n times
*
repeat 0 or more times
\{n\}
match before character repeats N times
.*
matches any numbe
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.