Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Extended regularity of regular expressions

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Extended regularity

Extended regularity means that the expression contains: +? | | {} and other symbols cannot be used directly in grep. You need to add\ extension |

If you don't want to add\ topology, you can use egrep or grep-E.

Extended regular: sed-r, and grep options, with +? | | r option is required when {} symbol is added, and\ topology is required if it is not added. |

Awk supports all functions of grep and sed by default.

The size of awk cannot be compared with numbers and letters, and this comparison cannot be made.

Extended regular? + | {}

? Extended regular representation:? There are 0 or 1 characters before it

A1? = > an or A1

The extended regular means that there are positive integers before the + characters.

| | extended regular representation: or |

{} indicates range

Some of the meanings of special symbols:

. Represents any one character

A b 0: the preceding character has 0 or more

Abc

Ab abccc

. It means greedy matching.

Egrep 'abc | 123' 1.txt

[] represents a character in square brackets

[a-zA-Z0-9] [abc] [a | @] [^]

^ indicates the beginning

$indicates the end

A {1,5} b {3}

() the characters in parentheses are regarded as a whole

(abc) {2} = "abcabc

(abc) +

Abc {2} = = > abcc

Awk-F'[#: |]'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report