Jump to content
Sign in to follow this  
HockeyFan

String Help

Recommended Posts

HockeyFan

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?

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
HockeyFan

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. :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×