Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6649
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!indigo.octanews.net!news-out.octanews.net!mauve.octanews.net!newsfeeds.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail |
|---|---|
| From | James Stein <mathgroup@stein.org> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Help: Regular expressions |
| Date | Wed, 23 Nov 2011 12:04:26 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <jainga$efl$1@smc.vnet.net> (permalink) |
| References | <jad600$eig$1@smc.vnet.net> <201111221036.FAA28079@smc.vnet.net> |
| Lines | 53 |
| NNTP-Posting-Date | 23 Nov 2011 11:08:44 GMT |
| NNTP-Posting-Host | 01607035.news.twtelecom.net |
| X-Trace | DXC=cO7jXAdXX1:9HeVjOG^fc<C_A=>8kQj6=m^eQlV`f187SeG:jH:JWE7EFiONJ7[Go6=lmE47cMeN0 |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:6649 |
Show key headers only | View raw
<oleksandr_rasputinov@hmamail.com> wrote:
> If you find regular expressions opaque and difficult to work with (and who
> doesn't?) then you might be better off using Mathematica's string pattern
> syntax instead.
Yes, I've been using regular expressions (infrequently ) for decades, and
usually must resort to a reference to do what I wish. For people with
MacIntosh computers, the free text editor "TextWrangler" comes bundled with
a manual with one or two clear chapters on regular expressions.
On Tue, Nov 22, 2011 at 2:36 AM, Oleksandr Rasputinov <
oleksandr_rasputinov@hmamail.com> wrote:
> On Mon, 21 Nov 2011 09:34:56 -0000, Shizu <slivo.vitz@msa.hinet.net>
> wrote:
>
> > Hello,
> >
> > Would anybody tell me what's the difference between these two --
> > with amd without "^"?
> > Regular expressions are not easy for me!
> >
> >
> > In= StringSplit["line1\nline2\nline3", RegularExpression["(?m)^"]] //
> > InputForm
> >
> > Out= {"line1\n", "line2\n", "line3"}
> >
> > In= StringSplit["line1\nline2\nline3", RegularExpression["(?m)"]] //
> > InputForm
> >
> > Out= {"l", "i", "n", "e", "1", "\n", "l", "i", "n", "e", "2", "\n", "l",
> > "i",
> > "n", "e", "3"}
> >
> > Thanks in advance.
> >
>
> The difference is that the latter is equivalent to
>
> StringSplit["line1\nline2\nline3", RegularExpression[""]]
>
> since (?m) is just an option which makes ^ match line beginnings rather
> than the beginning of the string as a whole.
>
> If you find regular expressions opaque and difficult to work with (and who
> doesn't?) then you might be better off using Mathematica's string pattern
> syntax instead.
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Help: Regular expressions Shizu <slivo.vitz@msa.hinet.net> - 2011-11-21 09:34 +0000 Re: Help: Regular expressions "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-22 10:44 +0000 Re: Help: Regular expressions James Stein <mathgroup@stein.org> - 2011-11-23 12:04 +0000
csiph-web