oholdeno Posted March 29, 2006 Share Posted March 29, 2006 If I need to replace the following exact text:<Image PostProcess="keep">\S*</Image>with say, a blank spacehow would I do it?What I put between the tags is supposed to mean '0 or more non-whitespace characters' in regular expression language.I'm having trouble with the quotation marks around the word 'keep'. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 29, 2006 Moderators Share Posted March 29, 2006 http://www.autoitscript.com/forum/index.php?showtopic=23627It's also in the current release beta help file. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted March 29, 2006 Share Posted March 29, 2006 http://www.autoitscript.com/forum/index.php?showtopic=23627It's also in the current release beta help file.i need to update my beta again. blah. that's cool that it made it to the help file. Link to comment Share on other sites More sharing options...
oholdeno Posted March 29, 2006 Author Share Posted March 29, 2006 it doesn't say much about escaping special characters also can someone clear up what the '?' does after a repeating pattern? Link to comment Share on other sites More sharing options...
herewasplato Posted March 30, 2006 Share Posted March 30, 2006 You might want to read Valik and Dale in this thread:http://www.autoitscript.com/forum/index.ph...ndpost&p=107753and thenhttp://www.autoitscript.com/forum/index.php?showtopic=19848hope this helps [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Stumpii Posted March 30, 2006 Share Posted March 30, 2006 ? after a repeating pattern will find the smallest match instead of the largest. This is in the help file (though the help file sucks for most everthing else to do with regex).Search the web for regular expressions and you will find alot. 90% is the same whatever library you are using. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
billmez Posted March 30, 2006 Share Posted March 30, 2006 If I need to replace the following exact text:<Image PostProcess="keep">\S*</Image>with say, a blank spacehow would I do it?What I put between the tags is supposed to mean '0 or more non-whitespace characters' in regular expression language.I'm having trouble with the quotation marks around the word 'keep'.Though not entirely familiar with AutoIT regex, in others if you are using regex to match or replace you need to escape special characters that would mean \" in the match side for quotes and \\S\* for the middle. If you are telling regex to match \ and * both are special characters and need to be escaped using a \. Link to comment Share on other sites More sharing options...
Stumpii Posted March 30, 2006 Share Posted March 30, 2006 (edited) Do you want to get rid of the entire string "<Image PostProcess="keep">\S*</Image>", or just the Image info "\S*" ? A pattern of "<Image PostProcess="keep">(.*)</Image>" will eliminate the \S* text. A pattern of "(<Image PostProcess=".*">.*</Image>)" will eliminate the complete string, regardless of the the "keep" or "\S*" Really need more info on what you are doing and why. Edited March 30, 2006 by Stumpii Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
neogia Posted March 30, 2006 Share Posted March 30, 2006 Do you want to get rid of the entire string "<Image PostProcess="keep">\S*</Image>", or just the Image info "\S*" ? A pattern of "<Image PostProcess="keep">(.*)</Image>" will eliminate the \S* text. A pattern of "(<Image PostProcess=".*">.*</Image>)" will eliminate the complete string, regardless of the the "keep" or "\S*" Really need more info on what you are doing and why.Keep in mind that if you have two or more instances of this tag, your second example, Stumpii, will eliminate ALL text between the first and last instance. <Image PostProcess="keep">\S*</Image> .... ....more XML .... <Image PostProcess="keep">\S*</Image> When you replace PostProcess="keep" with PostProcess=".*" , it will match ANY character up to the next double-quote. You need to add a "?", like so: PostProcess=".*?" [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia 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