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

Regular expression format

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Regular expression metacharacters:

. Match any single character

*: match the preceding characters any number of times

? Match the preceding characters once or 0 times

\ {mdirection n\}: match the preceding characters at least m times and n times at most

Position Anchor:

^: anchor the beginning of the line, and the content after this character must appear at the beginning of the line

$: anchor the end of the line, and the content after this character must appear at the end of the line

^ $: blank line

\

< :其后面的内容必须作为单词首部出现 \>

The content after it must appear as the end of the word

[]: any character in the specified range. Egrep [q,w] / tmp/test

Regular expression of extension:

. Match any single character

*: match the preceding characters any number of times

? Match the preceding characters once or 0 times

+: match the preceding characters at least once

{m,n}:

C | Cat! = c | (Cat)

Example: ifconfig | egrep-o "(\\.) {3}\" you can get all the IP

Integer judgment

-eq equals

-ne is not equal to

-gt is greater than

-ge greater than or equal to

-lt less than

-le is less than or equal to

Document judgment

-e: whether the file exists

-f: test whether the file is a normal file

-d: test whether it is a directory

-r

-w read and write execution is for the current user

-x

String test

=, =: [string1 = string2] or [string1 = = string2]

! =: test whether two strings are not equal to

-n string: tests whether the specified string is empty

-z string: tests whether the specified string is not empty

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

Network Security

Wechat

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

12
Report