-4
私はPHPで使用するこの正規表現を理解しようとしていますが、私はnoobyですので、私にとっては非常に難しいです。この正規表現は何をしてくれますか?URL正規表現comprension
/(?:https?:\/\/)?(?:[a-zA-Z0-9.-]+?\.(?:[a-zA-Z])|\d+\.\d+\.\d+\.\d+)/
ありがとうございました!
より多くの情報ビューについては私はPHPで使用するこの正規表現を理解しようとしていますが、私はnoobyですので、私にとっては非常に難しいです。この正規表現は何をしてくれますか?URL正規表現comprension
/(?:https?:\/\/)?(?:[a-zA-Z0-9.-]+?\.(?:[a-zA-Z])|\d+\.\d+\.\d+\.\d+)/
ありがとうございました!
より多くの情報ビューについてはBrackets
[0-9] - It matches any decimal digit from 0 through 9.
[a-z] - It matches any character from lower-case a through lowercase z.
[A-Z] - It matches any character from uppercase A through uppercase Z.
[a-Z] - It matches any character from lowercase a through uppercase Z.
Quantifiers
p+ - It matches any string containing at least one p.
p* - It matches any string containing zero or more p's.
p? - It matches any string containing zero or one p's.
p{N} - It matches any string containing a sequence of N p's
p{2,3} - It matches any string containing a sequence of two or three p's.
p{2, } - It matches any string containing a sequence of at least two p's.
p$ - It matches any string with p at the end of it.
^p - It matches any string with p at the beginning of it.
Expression & Description
[[:alpha:]] - It matches any string containing alphabetic characters aA through zZ.
[[:digit:]] - It matches any string containing numerical digits 0 through 9.
[[:alnum:]] - It matches any string containing alphanumeric characters aA through zZ and 0 through 9.
[[:space:]] - It matches any string containing a space.
は、[この](https://www.tutorialspoint.com/php/php_regular_expression.htmを)読ん – Gahan
、なぜあなたはそれを使うのですか? – TimBrownlaw
@TimBrownlaw私は自分のコード上のURLを検証するためにそれを使用しますが、私はインターネット上でそれを見つけました。 – Weit