• Regular Expression


    PCRE

    • . Normally matches any character except a newline. Within square brackets the dot is literal.
    • ( ) Groups a series of pattern elements to a single element. When you match a pattern within parentheses, you can use any of $1, $2, … later to refer to the previously matched pattern.
    • ? Matches the preceding pattern element zero or one time.
    • ? Modifies the *, +, ? or {M,N} regex that comes before to match as few times as possible.
    • * Matches the preceding element zero or more times.
    • {M,N} Denotes the minimum M and the maximum N match count. N can be omitted and M can be 0: {M} matches “exactly” M times; {M,} matches “at least” M times; {0,N} matches “at most” N times. x* y+ z? is thus equivalent to x{0,} y{1,}, z{0,1}.
    • […] Denotes a set of possible character matches.
    • | Separates alternate possibilities.
    • \b Matches a zero-width boundary between a word-class character and either non-word class character or an edge; same as (^\w|\w$|\W\w|\w\W).
    • \w Matches an alphanumeric character, including “_”; same as [A-Za-z0-9_] in ASCII.
    • \W Matches a non-alphanumeric character, excluding “_”; same as [^A-Za-z0-9_] in ASCII.
    • \s Matches a whitespace character, which in ASCII are tab, line feed, form feed, carriage return, and space.
    • \S Matches anything but a whitespace.
    • \d Matches a digit; same as [0-9] in ASCII.
    • \D Matches a non-digit; same as [^0-9] in ASCII.
    • ^ Matches the beginning of a line or string.
    • $ Matches the end of a line or string.
    • [^…] Matches every character except the ones inside brackets.

    lookahead

    (?=regex)
    (?!regex)

    lookbehind

    (?<=regex)
    (?<!regex)
    Regular Expression

  • 相关阅读:
    深入了解Redission分布式锁原理以及可重入锁的原理
    java并发怎么控制资源
    Linux笔记--硬链接与软链接
    【云原生】服务网格kiali开发环境搭建问题解析
    C语言入门--指针
    nuiapp项目实战:导航栏动态切换效果实践案例树
    靠着这份Jmeter接口测试学习资料,我成功涨薪3K
    10-集合3-Map
    二叉树——堆(C语言实现)
    9月12日作业
  • 原文地址:https://blog.csdn.net/azenlijing/article/details/125513313