Use regular expressions to do front-end user name check has been returned false reasons

The reason: the habitual "|" symbols on both sides by a space, regular expressions can not appear the extra space

1. The correct regular expression:

  1 var regName = /(^[a-zA-Z0-9_-]{6,16}$) | (^[\u2E80-\u9FFF]{2,5})/;

2. Error regular expression:

  1 var regName = /(^[a-zA-Z0-9_-]{6,16}$)|(^[\u2E80-\u9FFF]{2,5})/;

Guess you like

Origin www.cnblogs.com/lveyHang/p/11779581.html