On 6 November 2016 at 06:14, Jovan Trujillo <jovan.trujil...@gmail.com> wrote:
>
> 1207003PE_GM_09TNPLM2.csv
>
> I originally though m/[A-Za-z0-9\_]+/ would work, but it captures both
> strings.
> So then I tried m/[A-Za-z0-9\_]+(?!\.)/ but I still get both strings
> captured.

Alternatively, if your use case allows it, it might be more viable to
use negative matching.

  $file !~ /[.]/ and print "$file has no extension"

There's probably a reason why you're not doing this already, but can't
tell from the context.

NB: Clearly defining what an "extension" means is also pertinent:

fooo.csv
fooo.jpg
fooo.jpeg
foo.tar.xz
foo.config
.config
.config.ini

You probably are just meaning "has a dot" or "has a dot followed by at
most 3 characters", but its hard to tell from context ( and there are
a lot of obvious cases where there is an "extension" suffix that is
greater than 3 characters )







-- 
Kent

KENTNL - https://metacpan.org/author/KENTNL

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to