Re: A little regex help please ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2006-07-10 at 07:49 -0700, Brian D. McGrew wrote:
> Regex has always been a mystery to me, any help would be great!

As someone else pointed out, you're doing 'globbing', or pathname
expansion.  If you do want to learn and debug POSIX style regular
expressions, I highly recommend regex-coach.  You can type in a regex,
and some text, and see what it matches.  Lots of features.

See:
http://weitz.de/regex-coach/

p.s. If I've understood what you want, my solution would be:

#!/bin/bash
shopt -s extglob
for file in *[0-9].*[0-9].*[0-9] ; do
	# stuff
done

this will iterate over all files/directories of the form
number.number.number and ignore everything else.

Matt
Matt Davey		Make it as simple as possible, but no simpler.
mcdavey@xxxxxxxxxxxxxx 			     Einstein.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux