From: Intransition Date: 2011-11-16T10:23:14+09:00 Subject: Regex to divide document into sections? ------=_Part_345_2601328.1321406591812 Content-Type: multipart/alternative; boundary="----=_Part_346_17646718.1321406591816" ------=_Part_346_17646718.1321406591816 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Any expert regexp wrangler around here. I can't quite find a way to split a document up in sections: This is an example. a = 1 Of what I mean. b = 2 And it can go on like this. c = 3 For ever and ever. d = 4 So how does one parse it? I want to split it into groups, such that if in yaml it would be: --- - | This is an example. a = 1 - | Of what I mean. b = 2 - | And it can go on like this. c = 3 - | For ever and ever. d = 4 - | So how does one parse it? I can write a line-by-line algorithm, but I figure there has to be an regexp that can do it more better. ------=_Part_346_17646718.1321406591816 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Any expert regexp wrangler around here. I can't quite find a way to split a= document up in sections:

    This is an examp= le.
        a =3D 1
    O= f what I mean.
        b =3D 2

=
    And it can go on
    like this= .

        c =3D 3
&n= bsp;   For ever and ever.

     = ;   d =3D 4

    So how does one par= se it?

I want to split it into groups, such that i= f in yaml it would be:

    ---
=
  &= nbsp; - |
          a =3D= 1
 = ;   - |
      Of what I mean.
          b =3D = 2

  &n= bsp; - |
      And it can go on
      like this.

      &n= bsp; c =3D 3
    - |
      For ever and ever.

        d = =3D 4
 = ;   - |
      So how does one parse it?

I can write a line-by-line algorithm, but I figure there has t= o be an regexp that can do it more better.
 
------=_Part_346_17646718.1321406591816-- ------=_Part_345_2601328.1321406591812--