Skip to content

Instantly share code, notes, and snippets.

@kbbgl
Created May 7, 2020 16:57
Show Gist options
  • Save kbbgl/54d7a909339fb66fb3c4d1111eec9df5 to your computer and use it in GitHub Desktop.
Save kbbgl/54d7a909339fb66fb3c4d1111eec9df5 to your computer and use it in GitHub Desktop.
[match x amount of times using iterations] #regex
# using the {x} will match whatever comes before it x amount of times
echo "12341234444412354444" | grep -P "4{3}" # will match 3 times '444'
# using the {x,y} will match a range from x to y
echo "12341234444344412354444" | grep -P "4{1,4}" # will match 4, 4444, 444, 4444[
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment