RegEx...????

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
Niroj@Work
Pro Scripter
Posts: 63
Joined: Thu Dec 10, 2009 8:13 am

RegEx...????

Post by Niroj@Work » Tue Dec 22, 2009 11:14 am

Please Check the Code below:
===========================
Let>TrimmedStr={ niroj thbs }
RegEx>\s+$,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
RegEx>^\s+,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr

MessageModal>"%TrimmedStr%"

The above code is throwing an error.."Unknow Identifier Niroj"

Now check the code:
================
Let>TrimmedStr= { niroj thbs }
RegEx>\s+$,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
RegEx>^\s+,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr

MessageModal>"%TrimmedStr%"

Showing proper result "{ niroj thbs }"


BUG: :!: :?:
======
Is it a valid BUG?
While assgning TrimmedStr if no space is given after "=" then RegEx is failing....

Please have a look...
Thanks.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Dec 22, 2009 2:16 pm

{ ... } is reserved for complex expressions, so it is trying to resolve "niroj thbs" as a complex expression. Force it as a string instead:

Let>TrimmedStr={"{ niroj thbs }"}
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Niroj@Work
Pro Scripter
Posts: 63
Joined: Thu Dec 10, 2009 8:13 am

Post by Niroj@Work » Sat Dec 26, 2009 4:12 am

The problem here is that I am catching this kind of expressions dynamically from a text based application. .
If using RegEx I catch a text {kjkjkjkjjk...} raplaced in %str%, can I assgin it to a variable as:

Let>string="%str%"?
Will not it take " also??

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