The regular master asks for advice, a problem of limiting the overall length.

regular: / ^ [u4e00-u9fa5] + (- [u4e00-u9fa5] +) * $/

description: for matching Chinese names found on the Internet, ethnic minorities are separated by horizontal lines. I now want to limit the overall length to 2-6 digits for advice. Thank you in advance


/ ^ (? =. {2 u4e00-u9fa5 6} $) [u4e00-u9fa5] + (- [u4e00-u9fa5] +) * $/ try


/(^[\u4e00-\u9fe5]{2,2}(-[\u4e00-\u9fe5]{2,4})*$)|(^[\u4e00-\u9fe5]{3,3}(-[\u4e00-\u9fe5]{2,3})*$)/
The

| operator matches the preceding subexpression or the subsequent subexpression.
because-there may be 2 or 3 words in front of it, if you limit the overall number of words, the number of matching words needs to change according to the previous, so there are two cases, use the | operator to select.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38db6-4118a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38db6-4118a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?