• 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

  • 相关阅读:
    高并发秒杀项目总结
    C++11新特性(一)
    Mybatis动态sql全面详解
    SQL之索引
    尝试搞懂 MySQL(一)
    智能化“竞赛下半场”,什么才是可量产的最佳实践?
    java计算机毕业设计ssm办公耗材采购管理系统(源码+系统+mysql数据库+Lw文档)
    QT--day1
    H41H-40C法兰止回阀型号解析
    GCC常见命令
  • 原文地址:https://blog.csdn.net/azenlijing/article/details/125513313