当前位置:网站首页>Shell script - regular expression
Shell script - regular expression
2022-07-28 06:55:00 【Fish fire loach】
shell Script —— Regular expressions
One 、 Overview of regular expressions
1、 The concept of regular expression
It is usually used to judge , Used to check whether a string satisfies a certain format
Regular expressions are divided into basic regular expressions and extended regular expressions
It's not a tool program , It's a standard basis for string processing
Search with a single string 、 Match a series of strings that conform to a certain syntax rule
It consists of ordinary characters (a~z), And special characters ( Also called “ Metacharacters ”) form
Ordinary characters include upper and lower case letters 、 Numbers 、 Punctuation and some other symbols
Metacharacters refer to special characters with special meaning in re regular expressions , It can be used to specify its leading characters ( The character before the metacharacter ) The occurrence pattern in the target object
2、 Supported by regular expressions Linux Text processing tools

#grep and awk Apply to extended regular expressions
grep -E
awk -r
3、 Common characters in basic regular expressions
Supported tools :grep、egrep、sed、awk

4、 Extended regular expression metacharacter

5、 Regular Expression Matching E-mail Address
user name @
^([a-zA-Z0-9_-.+]+)@
subdomain
([a-zA-Z0-9_-.]+)
Top-level domain name
.([a-zA-Z]{2,5})$
a-zA-Z0-9_-.]+)
Top-level domain name
.([a-zA-Z]{2,5})$
边栏推荐
猜你喜欢

浅谈Cookie和Session

How to describe a bug and the definition and life cycle of bug level

iptables防火墙

MySQL master-slave

shell脚本——“三剑客”之awk命令

What's a good gift for Tanabata? Niche and advanced product gift recommendation

如何描述一个BUG以及BUG级别的定义、生命周期

Lancher deployment practice

LNMP搭建过程详解

What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
随机推荐
PKU-2739-Sum of Consecutive Prime Numbers(筛素数法打表)
测试面试题集锦(五)| 自动化测试与性能测试篇(附答案)
单项链表的创建、遍历以及按要求查找结点
如何描述一个BUG以及BUG级别的定义、生命周期
Test interview questions collection (III) | computer network and database (with answers)
Prometheus monitoring Nacos
Hdu-5805-nanoape loves sequence (thinking questions)
Scratch command
遍历 二叉树
[C language] dynamic memory management
Hdu-5783 divide the sequence (greedy water question)
Which brand of air conduction earphones is better? These four should not be missed
修复故障扇区
软件开发中常见模型
Installation and configuration of unit test framework jest with typescript
技术分享 | 实战详解接口测试请求方式Get、post
HDU-1159-CommonSubsequence(LCS最长公共子序列)
Insertion and deletion of nodes in linked list
Hdu-2036-reform spring breeze blowing all over the ground (polygon area template)
Gerapy use