Regular Expression

xiaoxiao2021-03-06  54

// Simple and useful.

^: Begainning of a line.

: / ^ Love /

$: End of a line.

: / Love $ /; / ^ $ /

.: Matches One Character.

: /L..E/

*: Matches one or more preceding character.

: / * Love / Matches Begain with some space and backed by love.

[]: Matches One Character in The Set.

: ls -l | grep "^ [d]"

Matches One Character WITHIN A RANGE INT.

: / [A-ZA-Z0-9] /

[^]: Matches One Character NOT IN The SET.

: / [^ a-z]

/: Used to escape a meta character.

: /.

<: Matches Lines Containing a Word That Begins with

: //

>: Matches Lines Containing a Word That End with

: / love /> /

/ (../): tags match characters to be used.

: // (Love /) ABLE / 1ER /

x {m, /}: matches Repetition (Again) of Character X, M Times.

x {m, n /}: matches repetition (Again) of character x, m to n Times.

转载请注明原文地址:https://www.9cbs.com/read-115255.html

New Post(0)