What does the regular expression /_/g mean?

后端 未结 3 567
再見小時候
再見小時候 2020-11-29 17:03

JavaScript:

.replace(/_/g,\" \");

I have it in my code but can\'t remember why or what it does! Can one of you regular expression gurus hel

3条回答
  •  天命终不由人
    2020-11-29 17:42

    The regex matches the _ character.

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

提交回复
热议问题