The title really says it all. Can anyone point me to where I could find descriptions of the different regex types available to the find command. I'm able to find a list of them but no explanations or comparisons. In particular, what could the difference be between 'posix-egrep' and 'posix-extended,' since egrep is a tool for regex matching according to the extended set?
10 ' posix-extended ' regular expression syntax. The character ' . ' matches any single character except the null character. ' + ' indicates that the regular expression should match one or more occurrences of the previous atom or regexp.
5.2 Basic (BRE) and extended (ERE) regular expression In GNU sed , the only difference between basic and extended regular expressions is in the behavior of a few special characters: ' ? ', ' + ', parentheses, braces (' {} '), and ' | '.
Regular expressions (shortened as regex) are powerful tools described by character sequences that specify a search pattern. This is why their use together with find yields a more refined search with a more reduced command.
grep extended regex (search multiple words) For example to search words abc, fgh, xyz, mno and jkl, use the search pattern "abc|fgh|xyz|mno|jkl".
Let me guide through you how you should use linux's documentation to self-answer questions like this by showing you how exactly I locate information.
man find
to see some basic information of regular expression type by searching the keyword, regular
, then I see this:-regextype type
Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. To see which regular expression types are known, use -regextype help. The Texinfo documentation (see SEE ALSO) explains the meaning of and differences between the various types of regular expression.
Assuming this is what you are looking for, the doc says it's in Texinfo
, so I do the next step;
info find
. Then search regextype
to locate the correct section for it. Then I reached:'--regextype'
This option changes the regular expression syntax and behaviour used by the '--regex' option. *note Regular Expressions:: for more information on the regular expression dialects understood by GNU findutils.
It asks to refer to a further documentation named note Regular Expressions, which you can go to there by hitting enter when cursor's on it.
Menu:
findutils-default regular expression syntax::
awk regular expression syntax::
egrep regular expression syntax::
emacs regular expression syntax::
gnu-awk regular expression syntax::
grep regular expression syntax::
posix-awk regular expression syntax::
posix-basic regular expression syntax::
posix-egrep regular expression syntax::
posix-extended regular expression syntax::
The last two items are exactly what you are asking. Read both of them, and then you can find out that the system already has the proper answers for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With