To test the voltage regulator, you can use a multimeter. With the engine running, measure the voltage at the battery. It should be between 13.8 and 14.7 volts. If the voltage is too high or too low, the voltage regulator may be faulty.
To replace the voltage regulator, you will need to remove the seat, the side cover, and the air filter cover. Once you have access to the voltage regulator, you can disconnect the electrical connectors and remove it from the motorcycle. Be sure to install the new voltage regulator in the correct orientation, as there is a positive and a negative terminal.
Once the new voltage regulator is installed, you can reattach the air filter cover, the side cover, and the seat. Start the motorcycle and check the voltage at the battery again. It should now be within the normal range.