billthecreator Posted October 2, 2009 Posted October 2, 2009 how do you replace a string that has "( )" in it with stuff in it. Like: $string = "Stuff (more stuff)" i want: $NewString = "Stuff" $NewSub = "more stuff" [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
JRowe Posted October 2, 2009 Posted October 2, 2009 $string = StringRegExpReplace ( "MyTest(ThisTextGoingByeBye)", "\((\w+)\)", "(Text Is All Up In Here)") MsgBox(0, "1", $string) Something like that should do ya. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
andygo Posted October 2, 2009 Posted October 2, 2009 how do you replace a string that has "( )" in it with stuff in it. Like: $string = "Stuff (more stuff)" i want: $NewString = "Stuff" $NewSub = "more stuff" #Include <string.au3> _StringExplode($sString, $sDelimiter [, $iLimit] )
billthecreator Posted October 2, 2009 Author Posted October 2, 2009 that didnt seem to work. the string inside of the perens "()", has numbers and other symbols... the \w didnt work [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
JRowe Posted October 3, 2009 Posted October 3, 2009 $string = StringRegExpReplace ( "MyTest(ThisTex$%&{}tGoingByeBye)", "\((.+)\)", "(Text Is All Up In Here)") MsgBox(0, "Revised", $string) Used .+ instead. Should work so long as you don't have newlines between parens? [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
billthecreator Posted October 3, 2009 Author Posted October 3, 2009 #Include <string.au3> _StringExplode($sString, $sDelimiter [, $iLimit] ) works, but the last post works as well, and looks nicer, since i would need an array for this way thanks both for your help [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
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