Open Bug 1359860 Opened 2 years ago

Make /W special character regex more clear

Categories

(Developer Documentation :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

UNCONFIRMED

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.
You need to log in before you can comment on or make changes to this bug.