-
-
Save kbbgl/54d7a909339fb66fb3c4d1111eec9df5 to your computer and use it in GitHub Desktop.
[match x amount of times using iterations] #regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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