Jump to content

Recommended Posts

Posted

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

  • Moderators
Posted

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

Posted

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)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...