Home >Backend Development >PHP Tutorial >tags - PHP matching tags regular expression

tags - PHP matching tags regular expression

WBOY
WBOYOriginal
2016-08-04 09:19:041216browse

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.

Reply content:

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn