Jump to content
Sign in to follow this  
Chlar

Generic character in string

Recommended Posts

Chlar

Hi,

I can't get the expression for a variable string. I've looked into Stringregexp function to find how i could replace a letter by \w. But no success.

I tried to use the " * " as for a file name with any extension : "File.*"

here is my point :

i would like to find in a file these expressions:

sharedFolder0.hostPath = "D:\"

sharedFolder1.hostPath = "O:\"

$NewDirectory

_replacestringinfile("Directory",'sharedFolder0.hostPath = "???"','sharedFolder0.hostPath = $NewDirectory')

What must i put instead of "???" ?

Help please!

Share this post


Link to post
Share on other sites
Mat

The easiest would be to use "[^"]"

Edit: Should have been "[^"]*"

Edited by Mat

Share this post


Link to post
Share on other sites
Chlar

thx for replying that fast.

Should i use it like that : 'sharedFolder0.hostPath = "[^"]:"' It doesn't work.

I've tried [] or [.] too

Edited by Chlar

Share this post


Link to post
Share on other sites
Mat

Sorry, missed the * in my last post. Should have been "[^"]*". You don't need the : as that pattern matches anything between " and ".

Edit: You should also get used to escaping characters. So you should use: sharedFolder0.hostPath

Edited by Mat

Share this post


Link to post
Share on other sites
Chlar

Is this correct : 'sharedFolder0.hostPath = "[^"]*"' Cause it still doesn't work...

Maybe there is a problem with the quotes

Sorry for being dumb i am so bad with that character section of autoit...

Share this post


Link to post
Share on other sites
Chlar

Yes it's working but it seems like this doesn't work for the _replacestringinfile UDF...

By the way thank you i will look for another solution, this one was too simple to be true... ;)

Edited by Chlar

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  

×