The regex matches the _ character.
The g means Global, and causes the replace call to replace all matches, not just the first one.
The regex matches the _ character.
The g means Global, and causes the replace call to replace all matches, not just the first one.