📜  grep 可选字符 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:00.688000             🧑  作者: Mango

代码示例1
# You can use append \? to a capture group to make something optional:

grep -nri "^\s*\(public\|private\|protected\)\s*\(static\)\?\s*\(sub\|function\)" formName.frm

#In this case, the preceding group, which contains the string "static", is optional (i.e. may occur 0 or 1 times).