Jump to content

Recommended Posts

Posted

I'm trying to write a regular expression to test if a file path has a file extension at the end.  I'm testing for...     after the last fullstop (period) then there's only characters up to the end of the string.   I get a bit fullstop happy writing regex and worry that im casting too wide a net.  This works i think but is there a better way?

Local $path = '"' & @ScriptDir & "\Log_" & @YEAR & "-" & @MON & "-" & @MDAY & ".csv" & '"'
$array = StringRegExp($path,"\.(.+)\z",0)
msgbox(1,"HAS FILE EXTENSION?",$array)

I know about PathSplit.  Just trying to learn.

Posted

Hi.

There is a builtin function to deal with drive/path/filename/extension

 

See _PathSplit()

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...