Escape {}

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Escape {}

Post by armsys » Fri Aug 09, 2013 11:21 pm

In MS, the {} pair is interpreted as a complex function.
In some cases, it's not desirable.
For example, {n,m} is interpreted as a range in RegEx.
Gosub>F&R,^13{2,0},,W
In this case, F&R_Var_1 is wrongly interpreted by MS.
Currently I circumvent the restriction by:
Let>Str=^13{2,0}
Gosub>F&R,%Str%,,W

No, Gosub>F&R,{"^13{2,0}"},,W won't help in this case.

QUESTION
Does MS support escape (meta)characters for {}?

Thanks in advance.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Aug 10, 2013 3:11 am

I wonder... will {"{n,m}"} work?

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Aug 10, 2013 4:09 am

JRL wrote:I wonder... will {"{n,m}"} work?
Hi JRL,
I just tested your suggested code but no luck.
No, it won't work.

Gosub>F&R,^13{"{2,}"}
// Find & Replace
SRT>F&R
MDL>F&R_Var_1
End>F&R

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Aug 10, 2013 5:23 am

Oops. Sorry I didn't look closely enough. The problem isn't the brackets, the problem is the comma. The comma is a parameter delimiter unless you use a variable as a substitute. Try this:

Code: Select all

Let>comma=,

Gosub>F&R,^13{2%comma%0}
// Find & Replace
SRT>F&R
MDL>F&R_Var_1
End>F&R

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Aug 10, 2013 6:53 am

JRL wrote:Oops. Sorry I didn't look closely enough. The problem isn't the brackets, the problem is the comma. The comma is a parameter delimiter unless you use a variable as a substitute. Try this:

Code: Select all

Let>comma=,
Gosub>F&R,^13{2%comma%0}
// Find & Replace
SRT>F&R
MDL>F&R_Var_1
End>F&R
Hi JRL,
Your magnificent solution relieves all pains in my neck.
Yeah, the comma is the culprit.
BTW, %comma% is a built-in variable.

Gosub>F&R,^l{1%comma%},^13,W
Gosub>F&R,^13{2%comma%},^13,W
I offer my mea culpa for being ignorant in not identifying the comma as the troublemaker in the first place. Again, it's my fault.
It reminds me that I still have much to learn.
Thanks for your help.
Have a nice weekend.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts