HockeyFan Posted June 4, 2007 Share Posted June 4, 2007 Can anyone provide some assistance with removing alphanumeric characters from within a string? What I'm attempting to do is remove a string of alphanumeric characters from within a string defined by "{" and "}". For example, I would like to remove the alphanumeric characters between the { and } in the following string: msiexec.exe /x /qn {B36EEFBE-8F3E-407A-8BDF-0B7EC3ECF15B} I thought about removing the first 19 characters (msiexec.exe /x /qn ) using... StringTrimLeft ( "string", 19 ) ...but its not always 19 characters to the first "{". Is there a way to do a string search setting the beginning character and the ending character and extract whats in between? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 4, 2007 Developers Share Posted June 4, 2007 something like this? $test = "msiexec.exe /x /qn {B36EEFBE-8F3E-407A-8BDF-0B7EC3ECF15B}" $String = StringRegExp($test,"{(.*?)}",1,1) ConsoleWrite('$String[0] = ' & $String[0] & @crlf) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
HockeyFan Posted June 4, 2007 Author Share Posted June 4, 2007 something like this? $test = "msiexec.exe /x /qn {B36EEFBE-8F3E-407A-8BDF-0B7EC3ECF15B}" $String = StringRegExp($test,"{(.*?)}",1,1) ConsoleWrite('$String[0] = ' & $String[0] & @crlf) JdeB, Thanks for the help. I was looking at the SRE expression but I couldn't figure it out. The "pattern" confuses me. None the less, it works. Thanks for your help. 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