☰
-
Php 95
-
Java 94
-
Javascript 37
-
Regex 18
-
Git 17
-
Security 16
-
Docker 07
-
Python 58
-
Machine Learning 14
-
Book Highlights
Regex Grep Optional
Question mark in colou?r means u optional Used in many cases with parantheses grep '4(th)?' 4th 4 // matches both
Optional
p17 Question mark in u? means u optional.
#!/bin/sh
: "Optional items
Question mark in colou?r means u optional
It is placed after the character that is optional
Grouping for optional, is one of the main uses of parantheses
"
A='color colour colur colou semicolon'
B='4 4th 4th?'
echo $A | grep 'colou?r' -o -E | tee result.txt
echo $B | grep '4(th)?' -o -E | tee result.txt -a

color
colour
4
4th
4th
➥ Questions
Last update: 60 days ago