Path: news.mathworks.com!not-for-mail
From: "Will Campbell" <will.campbell@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Regexp Challenge
Date: Wed, 20 Jan 2010 11:12:51 -0500
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <hj7a1b$487$1@fred.mathworks.com>
References: <hj5e1c$7oj$1@fred.mathworks.com> <77d74c77-3913-4ad5-b40b-fc063a9aa07f@p8g2000yqb.googlegroups.com> <hj5rng$pk6$1@fred.mathworks.com> <hj6u7p$8cr$1@fred.mathworks.com>
Reply-To: "Will Campbell" <will.campbell@mathworks.com>
NNTP-Posting-Host: vpn-client-122-176-ah.mathworks.com
X-Trace: fred.mathworks.com 1264003948 4359 144.212.122.176 (20 Jan 2010 16:12:28 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 20 Jan 2010 16:12:28 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:600262

>> regexprep(A,'([^/]+/)(?!/)','${strrep($1,$1,'''')}')
>
> Your REGEXPREP is fine and fast (I think - I do not dare to copy it).
> But it is not nice Matlab poetry.
> It looks like someone has rolled an angry armadillo over the keyboard.
>
> Not your fault! Jan

I stared at this command for 20 minutes before I finally felt comfortable 
that I understood what it was doing. You're finding character arrays that 
end with a single / and removing them from the returned value, yes?  I agree 
with Jan that it doesn't look pretty to those not versed in regexp.  But I'd 
hardly call it lacking in poetry.  It's an acquired taste, like 
improvisation jazz.

Thanks for the help!
-Will