Home > Article > Backend Development > tags - PHP matching tags regular expression
Requirements:
1. Tags can contain double-character bytes (including Chinese), numbers, letters, underscores, and dashes. Each tag can have a maximum of 12 characters;
2. Tags are separated by English commas, with a maximum of 5 tags.
<code>/^([\x00-\xffA-Za-z0-9_]+)(,[\x00-\xffA-Za-z0-9_]+){0,4}$/u</code>
This is not correct, please write it correctly.
Requirements:
1. Tags can contain double-character bytes (including Chinese), numbers, letters, underscores, and dashes. Each tag can have a maximum of 12 characters;
2. Tags are separated by English commas, with a maximum of 5 tags.
<code>/^([\x00-\xffA-Za-z0-9_]+)(,[\x00-\xffA-Za-z0-9_]+){0,4}$/u</code>
This is not correct, please write it correctly.