On Mon, Apr 26, 2004 at 08:41:57AM -0700, Ryan Bowman wrote:
> I need a regular expression that will only match filenames with NO
> periods in them.  My attempts so far don't seem to work at all, in the
> least.  Can someone give me a hint, please?

Assuming perl or PCRE:

$file =~ /^[^.]*$/

I tested this with the perl debugger:

  DB<1> $file = 'filename'

  DB<2> print 'y' if $file =~ /^[^.]*$/
y
  DB<3> $file = 'filename.ext'

  DB<4> print 'y' if $file =~ /^[^.]*$/

  DB<5>

Is that what you're looking for?

Alan

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to