I've been asking 1 hour ago a similar question about regular expression using the grep command, pardon me if the prefered choice would have been to post in the same thread, if this is the case I would do so next time.
It might seems like basic synthax, but I'm trying to understand how regular expression recognition pattern works and the results I get seems to be contradicting the manual I'm reading about them ( I'm most likely not interpreting the material properly).
A files contains the following list of words:
mael@mael-HP:~/repertoireVide$ cat MySQLServ
remembré
emmuré
emmené
dilemmes
jumeaux
écrémage
emmena
emmailloter
flemmard
The following command gives the output
mael@mael-HP:~/repertoireVide$ grep -r 'emm*[a-f].[^ta]$'
MySQLServ:remembré
MySQLServ:emmené
MySQLServ:flemmard
I'm wondering why grep is not matching the word 'emmailloter', since 'emmailloter':
- contains 'em'
- contains a caracter between [a-f] afterwards : 'a'
- 'i' fulfills the '.' component
- does not end with either the caracter 't' or 'a'
Thanks.
.,*,+,?, then add^and$, then add more.grepunderstands these with-P, but if you want portability, POSIX basic and extended regular expressions are more often used with Unix command line tools.