Sign in to follow this  
Followers 0
mozart90

How to check if it's a valid Filename ?

3 posts in this topic

#1 ·  Posted (edited)

Hi,

I've got a string and I would like to use it as a file name. Unfortunatly there are often forbidden charaters in these strings like * or /.

(OS is win XP)

I didn't find anything to this topic in the forum.

I want to be sure to get a valid file name, so forbidden characters should be exchanged with a _ or something like that

Is there a UDF?

Is it clever to write this with regexp ?

Greetings mozart90

Edited by mozart90

Share this post


Link to post
Share on other sites



Hi,

Global $a = "theword.toCheck"
$return = StringRegExp($a, "^[A-Za-z0-9_ -\.]+$", 0)
If @error <> 0 Then MsgBox(64, "Something is wrong", "Damn :-)")
If $return Then
    MsgBox(64, "Info", "No bad char found")
Else
    MsgBox(16, "Info", "Bad char found")
EndIf

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0