[英]regular expression pattern for any string with specific length including new line
[英]regular expression pattern for any string with specific length
我想為preg_match構建模式,該模式將匹配長度為1到40個字符的任何字符串。 我找到了這個:
^[^<\x09]{1,40}\Z
但有了那個,我收到這個錯誤信息:
function.preg-match]: Unknown modifier '<' in ....
有什么建議嗎?
/^.{1,40}$/
應該匹配任何長度為1到40個字符的字符串。
它的作用是需要的.
,它匹配一切,重復1到40次( {1,40}
)。 ^
和$
是字符串開頭和結尾的錨點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.