help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regexp: how to split a cellstr array into substring arrays, each mat


From: Philip Nienhuis
Subject: Re: regexp: how to split a cellstr array into substring arrays, each matching regular expressions
Date: Mon, 21 May 2012 23:10:34 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Mike Miller wrote:
On Mon, May 21, 2012 at 3:47 PM, Philip Nienhuis<address@hidden>  wrote:
Philip Nienhuis wrote:
[...]
BTW,
octave:184>  ar = {'abcdefguvwxAny' ; 'acegxyzTrailing'; 'aJunk'}
ar =
{
[1,1] = abcdefguvwxAny
[2,1] = acegxyzTrailing
[3,1] = Junk
}
octave:186>  tt = regexp (ar, '[uvwxyz].*', 'match', 'once')
tt =
{
[1,1] = uvwxAny
[2,1] = xyzTrailing
[3,1] = unk
}

=>  is this a bug? (swallowing the "J" from the last entry)
[...]
I still have to check with ML on the last question (swallowing characters).

I don't see a bug, "[uvwzyx].*" matches "unk", right?  Maybe "Junk"
was a bad choice for this example? :)

(Note there was a mistake in copying stmt 184 - "aJunk" must have been "Junk" - bad editing by me.)

You may be right - admittedly, regular expressions is not my cup of tea.

Anyway this was just one example - during all my experimenting I saw a few other occasions where first characters were unexpectedly (by me) swallowed. In addition I found that regexp and regexprep feature more options than the texinfo help texts suggest. Makes for a confusing search.

Hopefully tomorrow I'll remember to check with ML at work.

Thanks,

Philip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]