Chlar Posted May 2, 2013 Share Posted May 2, 2013 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! Link to comment Share on other sites More sharing options...
Mat Posted May 2, 2013 Share Posted May 2, 2013 (edited) The easiest would be to use "[^"]" Edit: Should have been "[^"]*" Edited May 2, 2013 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Chlar Posted May 2, 2013 Author Share Posted May 2, 2013 (edited) thx for replying that fast. Should i use it like that : 'sharedFolder0.hostPath = "[^"]:"' It doesn't work. I've tried [] or [.] too Edited May 2, 2013 by Chlar Link to comment Share on other sites More sharing options...
Mat Posted May 2, 2013 Share Posted May 2, 2013 (edited) 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 May 2, 2013 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Chlar Posted May 2, 2013 Author Share Posted May 2, 2013 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... Link to comment Share on other sites More sharing options...
Mat Posted May 3, 2013 Share Posted May 3, 2013 Works fine here: StringRegExp('sharedFolder0.hostPath = "D:\"' & @CRLF & 'sharedFolder1.hostPath = "O:\"', 'sharedFolder0.hostPath = "[^"]*"', 3) AutoIt Project Listing Link to comment Share on other sites More sharing options...
Chlar Posted May 3, 2013 Author Share Posted May 3, 2013 (edited) 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 May 3, 2013 by Chlar Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now