Sign in to follow this  
Followers 0
AutoDave

String Replace problem in v3.1.1.84 (beta)

3 posts in this topic

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



#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)


[center]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.[/center]

Share this post


Link to post
Share on other sites

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  
Followers 0