开发者

What the Regex?

开发者 https://www.devze.com 2023-01-27 10:15 出处:网络
Can anyone tell me what this bit of regex does? </?[a-z0-9-=\"\"\'!\\$\\?%&\\*\\+@~##;,\\开发者_高级运维\\]*:[a-z0-9 -=\"\"\'!\\$\\?%&\\*\\+@~##;,\\\\]*>

Can anyone tell me what this bit of regex does?

</?[a-z0-9-=""'!\$\?%&\*\+@~##;,\开发者_高级运维\]*:[a-z0-9 -=""'!\$\?%&\*\+@~##;,\\]*>

My regex is not the best.


It matches sgml elements with namespace (start tags and end tags). Please note that this regex also matches elements without a name and/or namespace. But this regex will never match empty tags.

Will match: <:>, </:>, <abc:abc019>

Will not match <hello>, </abc>, <abc:abc019 />, <abc />


Finds a <, an optional /, zero or more of a bunch of characters, a :, zero or more of a bunch of characters, and a >.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号