php preg_split 功能

发布于 2024-09-16 18:00:30 字数 193 浏览 6 评论 0原文

有没有办法理解拆分模式中包含的以下逻辑:
preg_split("/[\s,]+/", "超文本语言,编程");

在宏伟的计划中,我理解它在做什么,但我真的想详细了解它是如何做的使用转义符和特殊字符符号。有没有对此有详细的解释?如果没有,请有人提供其工作原理的详细说明。这是非常有用的东西,可以说,我想完全拥有它。

is there a way to understand the following logic contained in the splitting pattern:
preg_split("/[\s,]+/", "hypertext language, programming");

in the grand scheme of things i understand what it is doing, but i really want a granular understand of how to use the escapes and special character notation. is there a granular explanation of this anywhere? if not could someone please provide a breakdown of how this works. it is something very useful, and something i would like to have completely under in my belt so to speak.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独﹏钓一江月 2024-09-23 18:00:30
+ means 1 or more

[\s,] means a space and/or comma character

这会将文本分割为 1 个或多个空格和逗号,在一起

肯定会读取 http://www.regular-expressions。 info/ 正如 Silfverstrom 推荐的那样。另外帮助我学习的是这个游戏:http://www.javaregex.com/agame.html

+ means 1 or more

[\s,] means a space and/or comma character

This will split the text by 1 or more spaces and commas together

definitely read http://www.regular-expressions.info/ as Silfverstrom recommended. Also what helped me learn was this game: http://www.javaregex.com/agame.html

仅一夜美梦 2024-09-23 18:00:30

你应该看看正则表达式,这可能是一个很好的起点
http://www.regular-expressions.info/reference.html

you should have a look at regular expressions, this might be a good place to start
http://www.regular-expressions.info/reference.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文