It sounds like the brushes in the regulator are worn out, hence why when the car idles the light comes on but when revved it goes of (most of the time). The way to test is:
Start the engine.
Using a volt meter check the voltage coming out of the alternator, usually a thick red wire on the back.
At idle the alternator should put out about 14.7 volts or there abouts.
Now turn on the heater fan, headlights (high beam), wipers, radio etc whilst the engine is still running.
Again check the voltage at the alternator. You will need a minimum of 13 volts to ensure that the electrics will operate as well as charge the battery. If you find that the voltage is any lower than this it points to the brushes in the alternator being worn out. These are easy to replace if you know how. If you have a workshop manual it will show you how this is done or alternatively give me a call and iI will talk you thru it. I wouldnt recommend removing the positive battery lead whilst the engine is running as the alternator thinks that the battery is completely flat and over excites the rectifiers inside the alternator. this can result in damage to the internals.
0414 373 388
Cheers Craig