Closed Bug 1359860 Opened 7 years ago Closed 4 years ago

Make /W special character regex more clear

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: james-barrett, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

First time contributor, so correct me if I am wrong!

I think that the '\W' special character should note that this does NOT include the underscore.

For example: 
var str = "_james" 
if (str[0].search(/\W/) !== -1) - I expected this to return true however it didn't. I needed to add '|| str[i] === "_"' to the conditional.

Could this be mentioned in the docs for clarity?

Thanks.
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.