Jump to content
Sign in to follow this  
AutoDave

String Replace problem in v3.1.1.84 (beta)

Recommended Posts

AutoDave

Hello all,

I tried the following:

$String = "!#+^{}"

$String = StringRegExpReplace($String,"([}{])","\1")

MsgBox (0,"",$String)

I would have expected the following output

!#+^{}

But instead I get

!#+^{{

Is there an explanation? Or is it just a bug (if yes, then I will post this in the bug forum as well)

Please advise.

Thanks,

Dave

Share this post


Link to post
Share on other sites
SmOke_N

#include <String.au3>

$String = "!#+^{}"
$String = StringRegExpReplace($String,"([}{])","\3") 
MsgBox (0,"",$String)

If you're going to use /1 try this one.

#include <String.au3>

$String = "!#+^{}"
$String = StringRegExpReplace($String,"([}])" & "([{])","\1") 
MsgBox (0,"",$String)

I don't know enough about StringRegExpReplace() to say if it's a bug, but the above does work (don't even know if it's correct ... lol)


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.

Share this post


Link to post
Share on other sites
AutoDave

Thanks for your suggestion, but there seems to be also something wrong:

$String = "}}{}"

$String = StringRegExpReplace($String,"([}])" & "([{])","\1")

MsgBox (0,"",$String)

Expected output:

}}{}

But instead I get:

}}}

Dave

#include <String.au3>

$String = "!#+^{}"
$String = StringRegExpReplace($String,"([}{])","\3") 
MsgBox (0,"",$String)

If you're going to use /1 try this one.

#include <String.au3>

$String = "!#+^{}"
$String = StringRegExpReplace($String,"([}])" & "([{])","\1") 
MsgBox (0,"",$String)

I don't know enough about StringRegExpReplace() to say if it's a bug, but the above does work (don't even know if it's correct ... lol)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.