Hi, the i doesn't does anything in this case, it is my mania of writing it always. The mdn's docu says this about \w:
i
Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_]
So \w is case insesitive already.
'mi ke$ha'.toLowerCase().replace(/\b\w/gi, c => c.toUpperCase()) //> "Mi Ke$Ha"
:'(
That was expected, which result do you wanted?
Try my honestly unironically inferior regex and see:
'mi ke$ha'.toLowerCase().replace(/(?:^|\s)\w/g, c => c.toUpperCase())
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, the
i
doesn't does anything in this case, it is my mania of writing it always. The mdn's docu says this about \w:So \w is case insesitive already.
OH NO
:'(
That was expected, which result do you wanted?
Try my honestly unironically inferior regex and see: