Re: Bug in Mathematica: regular expression applied to very
- To: mathgroup at smc.vnet.net
- Subject: [mg107492] Re: [mg107485] Bug in Mathematica: regular expression applied to very
- From: bsyehuda at gmail.com
- Date: Sun, 14 Feb 2010 08:17:26 -0500 (EST)
- References: <201002141059.FAA26040@smc.vnet.net>
You can use the MAthematica string manipulation functions. Let me lengthen the string in an obvious way, by duplicating it 1000 times. s = "This is the first line. MAGIC_STRING Everything after this line should get removed. 12345678901234567890123456789012345678901234567890123456789012345678\ 901234567890 12345678901234567890123456789012345678901234567890123456789012345678\ 901234567890 12345678901234567890123456789012345678901234567890123456789012345678\ 901234567890 12345678901234567890123456789012345678901234567890123456789012345678\ 901234567890 12345678901234567890123456789012345678901234567890123456789012345678\ 901234567890 ..."; s = Nest[StringJoin[s, #] &, s, 1000]; StringLength[s] 492492 StringDrop[ StringReplace[ s, (p : Shortest[___ ~~ "\n" ~~ ___ ~~ "\n" ~~ ___ ~~ "\n"]) ~~ ___ :> p], -1] so, processing only part of the string (using Shortest) gives the result in a fraction of a second yehuda On Sun, Feb 14, 2010 at 12:59 PM, dreeves <dreeves at gmail.com> wrote: > I believe I found a bug in Mathematica's regular expression engine: > > http://stackoverflow.com/questions/2257884/bug-in-mathematica-reg > > I've submitted a bug report to support@wolfram but also wondering if > you all have thoughts on workarounds. > > Thanks! > > PS: Here's an rss feed of questions tagged mathematica on > stackoverflow: > http://stackoverflow.com/feeds/tag?tagnames=mathematica > >
- References:
- Bug in Mathematica: regular expression applied to very long string
- From: dreeves <dreeves@gmail.com>
- Bug in Mathematica: regular expression applied to very long string