Regex: ignore case sensitivity

后端 未结 13 1967
孤城傲影
孤城傲影 2020-11-22 06:11

How can I make the following regex ignore case sensitivity? It should match all the correct characters but ignore whether they are lower or uppercase.

G[a-b]         


        
13条回答
  •  无人共我
    2020-11-22 06:56

    Addition to the already-accepted answers:

    Grep usage:

    Note that for greping it is simply the addition of the -i modifier. Ex: grep -rni regular_expression to search for this 'regular_expression' 'r'ecursively, case 'i'nsensitive, showing line 'n'umbers in the result.

    Also, here's a great tool for verifying regular expressions: https://regex101.com/

    Ex: See the expression and Explanation in this image.

    References:

    • man pages (man grep)
    • http://droptips.com/using-grep-and-ignoring-case-case-insensitive-grep

提交回复
热议问题