Regex 101: Difference between revisions
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
echo "My stuff" | grep "^My" | echo "My stuff" | grep "^My" | ||
=Examples= | =Examples= | ||
=Starts with= | ==Starts with== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
echo "A" |grep "^A" | echo "A" |grep "^A" | ||
echo "AAAAAAAAAAA" |grep "^A" | echo "AAAAAAAAAAA" |grep "^A" | ||
</syntaxhighlight> | |||
==Starts with and Ends With== | |||
<syntaxhighlight lang="bash"> | |||
echo "AAAAAAAAAAAB" |grep "^A*B$ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 02:42, 11 April 2021
Testing
echo "My stuff" | grep "^My"
Examples
Starts with
echo "A" |grep "^A"
echo "AAAAAAAAAAA" |grep "^A"
Starts with and Ends With
echo "AAAAAAAAAAAB" |grep "^A*B$
Starts with followed by
echo "AAAAAAAAAAAB" |grep "^A*B"