MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Recognizing newline character in regular expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67593] Re: Recognizing newline character in regular expressions
  • From: "Norbert Marxer" <marxer at mec.li>
  • Date: Sat, 1 Jul 2006 05:12:43 -0400 (EDT)
  • References: <e82nga$r1n$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi

You can read in the Mathematica documentation at

    http://documents.wolfram.com/mathematica/book/section-2.8.7

that in the string "text" line breaks in text are ignored,

whereas in the string "\<text\>" line breaks in text are inserted
explicitly as \n.

With this modification your code will work.

dataString = "\< 0.0000 0.00 0.0000 1.00 2
0.0000 11.97 -131.00 1.00 1
2.7083 11.97 -127.00 1.00 1\>";
StringReplace[dataString, RegularExpression["\n"] -> "*"]

Note that you can use ToCharacterCode@dataString to see, which
characters are stored in your string. The newline character has the
code 10.

Best Regards
Norbert Marxer
www.mec.li


  • Prev by Date: orthonormal eigenvectors
  • Next by Date: Re: when dimension increases
  • Previous by thread: Re: orthonormal eigenvectors
  • Next by thread: Re: Recognizing newline character in regular expressions