[SATLUG] character classes with *

MaxPower rudebags at hotmail.com
Wed Oct 1 15:21:50 CDT 2014


I'm having a bit of a hard time wrapping my head around what is actually going on here.  I'm attempting to learn about regular expressions and this use of character classes with * has me befuddled.
lap007:~/crap$ cat testaaLLyLayLaaya*
lap007:~/crap$ grep [abcdez]* test   ##why does this command include everything in the file (even the upper case L)?aaLLyLayLaaya*
lap007:~/crap$ grep [a-z]* test  ##while this command excludes everything in the file?lap007:~/crap$ 
lap007:~/crap$ grep [abcde]* test  ## once again total file returnedaaLLyLayLaaya*
lap007:~/crap$ grep [abcdef]* test  ##the addition of the letter f returns a null set?  buh?lap007:~/crap$ 

I understand that * isn't being used in its normal way and while I grasp the logic behindgrep [a-z].* test, grep [a-z]\* test, and grep '[a-z]*' the above has me quite miffed.
Thank you in advance for any clearing of the mud!
 		 	   		  


More information about the SATLUG mailing list