Regex 101: Difference between revisions
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= | =Match Start and End with anything in the middle= | ||
Look like \b is the better approach to ^ and $ | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
echo " | echo "AxxxxxxxB" |grep "\b\A\w*B\b" | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 02:53, 11 April 2021
Testing
echo "My stuff" | grep "^My"
Examples
Starts with
echo "A" |grep "^A"
echo "AAAAAAAAAAA" |grep "^A"
Starts with any number of As and Ends With
echo "AAAAAAAAAAAB" |grep "^A*B$
Match Start and End with anything in the middle
Look like \b is the better approach to ^ and $
echo "AxxxxxxxB" |grep "\b\A\w*B\b"