I want to remove all the spaces, carriage returns, and "comments" (the text inside the <>'s) from this document:

I tried the regular expression ( )|(\n)(|<.*>) , but that removes everything but the -1 at the end. It doesn't do that if I remove the |(<.*>) , but then it doesn't remove the <> comments.

<fps>                3,
<frames>             3600,
<x/width>            200,
<y/height>           150,
<boid count>         2,
<boid start x>       10,
<boid start y>       10,
<boid end x>         50,
<boid end y>         50,
<boid acc>           0.1,
<boid fric>          0.01,
<boid size>          3,
<boid sight dist>    12,
<boid blind angle>   1.57079633,
<boid avoid>         1,
<boid match>         1,
<boid center>        1,
<pred count>         1,
<pred start x>       10,
<pred start y>       70,
<pred end x>         50,
<pred end y>         110,
<pred acc>           0.1,
<pred fric>          0.01,
<pred size>          5,
<pred sight dist>    20,
<pred blind angle>   2.0943951,
<pred avoid>         1,
<pred chase>         1,
<obstacle start x>   20,
<obstacle start y>   20,
<obstacle end x>     130,
<obstacle end y>     180,
<obstacle min size>  5,
<obstacle max size>  12,
;;
<obstacles>
     <obstacle #1>
          <x>46,<y>46,<size>6
::
<frame 1>
     <boids>
          <boid #1>
               <x>11,<y>12,<dx>0,<dy>0
          ;
          <boid #2>
               <x>19,<y>36,<dx>0,<dy>0
     ;;
     <predators>
          <predator #1>
               <x>26,<y>98,<dx>0,<dy>0
:
<frame 2>
     <boids>
          <boid #1>
               <x>11,<y>12,<dx>1,<dy>0
          ;
          <boid #2>
               <x>19,<y>36,<dx>0,<dy>1
     ;;
     <predators>
          <predator #1>
               <x>26,<y>98,<dx>-1,<dy>-1
:
<frame 3>
     <boids>
          <boid #1>
               <x>12,<y>12,<dx>1,<dy>0
          ;
          <boid #2>
               <x>19,<y>37,<dx>0,<dy>1
     ;;
     <predators>
          <predator #1>
               <x>25,<y>97,<dx>-1,<dy>-1
:
<frame 4>
     <boids>
          <boid #1>
               <x>13,<y>12,<dx>1,<dy>0
          ;
          <boid #2>
               <x>19,<y>38,<dx>0,<dy>1
     ;;
     <predators>
          <predator #1>
               <x>24,<y>96,<dx>-1,<dy>-1

What's wrong? I'm utterly confused.

(\\s+|\\s*<[^>]+>\\s*)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.