agubler Posted February 18, 2009 Share Posted February 18, 2009 I am sure this is really simple, but it is melting my mind. I have a string: "MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public" The part "Custom["C"]" could have any letter within the quotes i.e. Custom["O"] or Custom["P"] I need to check the original string "MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public" and if "Custom[""]" exists with any character between the speecharks replace that character with D. examples Original string : MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public Required result : MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["D"]):Public Original string : MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["O"]):Public Required result : MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["D"]):Public Original string : MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public Required result : MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public Is this possible? Link to comment Share on other sites More sharing options...
youknowwho4eva Posted February 18, 2009 Share Posted February 18, 2009 I'd look up stringinstr and stringtrimleft and stringtrimright Giggity Link to comment Share on other sites More sharing options...
Paulie Posted February 18, 2009 Share Posted February 18, 2009 (edited) How about this? Dim $String[3] $String[0] = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public' $String[1] = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["O"]):Public' $String[2] = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public' For $x = 0 to 2 $NewString = StringRegExpReplace($String[$x], '\[\"\w\"\]', '["D"]') Msgbox(0,"","Original String: "&$String[$x]&@CRLF&"Resut: "&$NewString) Next Edited February 18, 2009 by Paulie Link to comment Share on other sites More sharing options...
Andreik Posted February 18, 2009 Share Posted February 18, 2009 (edited) $DATA = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public' MsgBox(0,"",StringReplace($DATA,'Custom["C"]','Custom["D"]')) EDIT: This work only if custom is C. Edited February 18, 2009 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Paulie Posted February 18, 2009 Share Posted February 18, 2009 $DATA = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public' MsgBox(0,"",StringReplace($DATA,'Custom["C"]','Custom["D"]'))I think he wanted to use regex because the 'Custom["C"]' could be any character A-Z ..at least that's what I gathered... Link to comment Share on other sites More sharing options...
Andreik Posted February 18, 2009 Share Posted February 18, 2009 I think he wanted to use regex because the 'Custom["C"]' could be any character A-Z ..at least that's what I gathered...Yes you have right. I was not careful. Thank you corrected me. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
agubler Posted February 18, 2009 Author Share Posted February 18, 2009 How about this? Dim $String[3] $String[0] = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["C"]):Public' $String[1] = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public(Custom["O"]):Public' $String[2] = 'MarketDeadlineDate (Title "O - Market Deadline DateTime"):Public' For $x = 0 to 2 $NewString = StringRegExpReplace($String[$x], '\[\"\w\"\]', '["D"]') Msgbox(0,"","Original String: "&$String[$x]&@CRLF&"Resut: "&$NewString) Next Paulie that is perfect, exactly what i was looking for. yeah the "C" could be any character. thanks alot 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