zoukankan      html  css  js  c++  java
  • 正则表达式

    正则表达式

    regular expression :

    • 正则表达式就是处理字符串的方法,它是以行为单位来进行字符串的处理行为,正则表达式通过一些特殊符号的辅助,可以让用户轻易达到查找、删除、替换某特定字符串的处理程序。

    常见的字符匹配

    常见的字符 表达的含义
    . Any character except newline ( )
    (a|b) a or b
    (...) Group
    [abc] a, b or c
    [^abc] Not a, b or c
    [a-z] Letters from a to z
    [A-Z] Uppercase letters from A to Z
    [0-9] Digits from 0 to 9

    注意 “^”符号:

    "^"符号在字符集合符号(中括号[])的内外是不同的

    • 在[]内代表 [^abc] 代表反向选择
    • 在[]外代表定位在行首的意义

    一些数量匹配的方法

    常见倍数 表达的含义
    * 0 or more
    + 1 or more
    ? 0 or 1
    {3} Exactly 3
    {3,} 3 or more
    {3,5} 3, 4 or 5

    一些位置匹配

    位置 表达的含义
    ^ Start of string or start of line in multi-line mode
    A Start of string
    $ End of string or end of line in multi-line mode
     End of string
    不要用狭隘的眼光看待不了解的事物,自己没有涉及到的领域不要急于否定. 每天学习一点,努力过好平凡的生活.
  • 相关阅读:
    天兔监控系统安装
    day6
    day5
    day4
    day3
    day2
    day1
    几个重要的Xenomai相关链接
    树莓派GPIO中断驱动程序
    转了一圈,再读LKD
  • 原文地址:https://www.cnblogs.com/GeekDanny/p/10112462.html
Copyright © 2011-2022 走看看