SRT>Trim
Let>TrimmedStr=Trim_Var_1
//Trimming out spaces at beg and end
RegEx>^\s+,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
RegEx>\s+$,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
//Trimming out any invisible chracters
RegEx>^[^\d\w\~`!@#$%^&*()_\-+={}|\\\]\["':;?/.>,[^\d\w\~`!@#$%^&*()_\-+={}|\\\]\["':;?/.>,Trim
//-------------------------------------------------------------
Let>TrimmedStr=fxafxggf...invisible chars
GoSub>Trim,%TrimmedStr%
Let>TrimmedStr=,%TrimmedStr%
====================================
Above I have written the above subroutine to trim all the invisible/spaces at both ends of a string. But while exceution the script showing error prompt that "Regular Pattern didn't Compile"
Why is it happening? I checked in Expresso it is giving me proper result..
Getting Error While doing Regular Pattern Matching--- Trim
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 63
- Joined: Thu Dec 10, 2009 8:13 am
Getting Error While doing Regular Pattern Matching--- Trim
Last edited by Niroj@Work on Mon Dec 14, 2009 1:58 pm, edited 1 time in total.
-
- Pro Scripter
- Posts: 63
- Joined: Thu Dec 10, 2009 8:13 am
Re: Getting Error While doing Regular Pattern Matching(Trim)
Niroj@Work wrote:SRT>Trim
Let>TrimmedStr=Trim_Var_1
//Trimming out spaces at beg and end
RegEx>^\s+,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
RegEx>\s+$,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
//Trimming out any invisible chracters
RegEx>^[^\d\w\~`!@#$%^&*()_\-+={}|\\\]\["':;?/.>,[^\d\w\~`!@#$%^&*()_\-+={}|\\\]\["':;?/.>,Trim
//-------------------------------------------------------------
Let>TrimmedStr=fxafxggf...invisible chars
GoSub>Trim,%TrimmedStr%
Let>TrimmedStr=,%TrimmedStr%
====================================
Above I have written the above subroutine to trim all the invisible/spaces at both ends of a string. But while exceution the script showing error prompt that "Regular Pattern didn't Compile"
Why is it happening? I checked in Expresso it is giving me proper result..
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You have commas in your pattern. Do this:
Code: Select all
SRT>Trim
Let>TrimmedStr=Trim_Var_1
//Trimming out spaces at beg and end
RegEx>^\s+,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
RegEx>\s+$,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
//Trimming out any invisible chracters
Let>pattern=^[^\d\w\~`!@#$%^&*()_\-+={}|\\\]\["':;?/.>,<]+
RegEx>pattern,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
Let>pattern=[^\d\w\~`!@#$%^&*()_\-+={}|\\\]\["':;?/.>,<]+$
RegEx>pattern,%TrimmedStr%,0,matchArr,TotMatches,1,,TrimmedStr
END>Trim
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?