Nov 17, 2014; 13:35
Jon Harris
RE: Stuck on Regex [LP8.6] [solved]
Thanks Brad (and Jolle)
That works great.
I owe you a pint (or its metric equivalent :-) ).
Regards
Jon
-----Original Message-----
From: lasso-bounces@lists.lassosoft.com [mailto:lasso-bounces@lists.lassosoft.com] On Behalf Of Brad Lindsay
Sent: 17 November 2014 13:37
To: lasso@lists.lassosoft.com
Subject: Re: Stuck on Regex [LP8.6]
Because the backslash is used to escape characters in a lasso string, you’re RegEx needs to have two backlashes to represent one. You might be able to do something like this:
local('original') = "'13 (10) Home Polo Shirt (Blk)";
local('test') = String_ReplaceRegExp(
#original,
-find="\\(\\d+\\)\\s*",
-replace = ""
);
#test;
This avoids replacing the color parenthesis by specifying that the contents inside the parentheses must be numbers.
HTH,
Brad
On November 17, 2014 at 8:10:51 AM, Jon Harris (j.harris@digital-ink.co.uk) wrote:
> Hi Lists
>
> I am importing some data from a clients' stock list, and I need to
> group similar products together.
>
> Typical product descriptions:
>
> "'13 (10) Home Polo Shirt (Blk)"
> "'13 (12) Home Polo Shirt (Blk)"
>
> I want to use regex to remove the size, which is always the first
> brackets in the string, so for my two products I would be left with.
>
> "'13 Home Polo Shirt (Blk)"
> "'13 Home Polo Shirt (Blk)"
>
> I used an on-line regex building page which gave me this:
>
> \(.+?\)\s*
>
> When I insert this in a RegExp expression, it doesn't work.
>
> var('x') = RegExp(-Find='\(.+?\)\s*', -Replace='',
> -Input=(var('theproduct')
> ) ;
>
> I must be missing slashing something off somewhere.
>
> Can someone correct my expression?
>
> Thanks for any pointers.
>
> Jon Harris
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to the mailing
> list Lasso Lasso@lists.lassosoft.com Official list archives available
> at http://www.lassotalk.com To unsubscribe, E-mail to:
> Send administrative queries to
>
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso Lasso@lists.lassosoft.com Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso Lasso@lists.lassosoft.com
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>