PHP正则表达式 - 如果自定义标点符号是并排的,则正则表达式不匹配

my regexp

/^[\p{L}\p{N}][\p{L}\p{N} \.,;:\?!-“”‘’"']+$/u

aim of regexp

allow utf-8 characters, numbers, spaces AND custom punctuation to verify article title

these inputs below don't match but I want matching also if punctuation are side-by side? Can you show me the correct form of my regexp? note: Backslash in front of dot and question mark are for escaping attempt. I also tried without escaping. I am not good at regexp. I can only find sub-parts then try to combine. thanks. BR

inputs that don't match

  1. "Selim"!'"':?-
  2. "'
  3. '"
  4. ?!
  5. I also discovered that I can not start with punctuation to a title. example "title" Day doesn't match

change with:

/^[\p{L}\p{N}“”‘’"'][\p{L}\p{N} .,;:?!\-“”‘’"']*$/u

NB: - must be escaped if it isn't in the first or last position within the character class. But . and ? doesn't need.

Are the square brackets within the regex characters you accept? If so, they need to be escaped.

/^[\p{L}\p{N}\]\[\p{L}\p{N} \.,;:\?!-“”‘’"']+$/u

If not, then you need to include the punctuation you'll allow inside the first character class.