• <bdo id='jiMis'></bdo><ul id='jiMis'></ul>
  • <tfoot id='jiMis'></tfoot>

    <small id='jiMis'></small><noframes id='jiMis'>

    <legend id='jiMis'><style id='jiMis'><dir id='jiMis'><q id='jiMis'></q></dir></style></legend>

        <i id='jiMis'><tr id='jiMis'><dt id='jiMis'><q id='jiMis'><span id='jiMis'><b id='jiMis'><form id='jiMis'><ins id='jiMis'></ins><ul id='jiMis'></ul><sub id='jiMis'></sub></form><legend id='jiMis'></legend><bdo id='jiMis'><pre id='jiMis'><center id='jiMis'></center></pre></bdo></b><th id='jiMis'></th></span></q></dt></tr></i><div id='jiMis'><tfoot id='jiMis'></tfoot><dl id='jiMis'><fieldset id='jiMis'></fieldset></dl></div>

        拆分包含字母和数字的字符串,在 PHP 中不被任何特定的分隔符分隔

        Splitting string containing letters and numbers not separated by any particular delimiter in PHP(拆分包含字母和数字的字符串,在 PHP 中不被任何特定的分隔符分隔)

          1. <small id='zsb0V'></small><noframes id='zsb0V'>

              <tfoot id='zsb0V'></tfoot>

                  <bdo id='zsb0V'></bdo><ul id='zsb0V'></ul>
                  <i id='zsb0V'><tr id='zsb0V'><dt id='zsb0V'><q id='zsb0V'><span id='zsb0V'><b id='zsb0V'><form id='zsb0V'><ins id='zsb0V'></ins><ul id='zsb0V'></ul><sub id='zsb0V'></sub></form><legend id='zsb0V'></legend><bdo id='zsb0V'><pre id='zsb0V'><center id='zsb0V'></center></pre></bdo></b><th id='zsb0V'></th></span></q></dt></tr></i><div id='zsb0V'><tfoot id='zsb0V'></tfoot><dl id='zsb0V'><fieldset id='zsb0V'></fieldset></dl></div>
                    <tbody id='zsb0V'></tbody>
                • <legend id='zsb0V'><style id='zsb0V'><dir id='zsb0V'><q id='zsb0V'></q></dir></style></legend>
                • 本文介绍了拆分包含字母和数字的字符串,在 PHP 中不被任何特定的分隔符分隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  目前我正在开发一个 Web 应用程序来获取 Twitter 流并尝试自己创建一个自然语言处理.

                  Currently I am developing a web application to fetch Twitter stream and trying to create a natural language processing by my own.

                  由于我的数据来自 Twitter(限制为 140 个字符),因此缩短了许多单词,或者在这种情况下,省略了空格.

                  Since my data is from Twitter (limited by 140 characters) there are many words shortened, or on this case, omitted space.

                  例如:

                  "Hi, my name is Bob. I m 19yo and 170cm tall"
                  

                  应该被标记为:

                  - hi
                  - my
                  - name
                  - bob
                  - i
                  - 19
                  - yo
                  - 170
                  - cm
                  - tall
                  

                  注意1919yo中的yo之间没有空格.我主要用它来提取带有单位的数字.

                  Notice that 19 and yo in 19yo have no space between them. I use it mostly for extracting numbers with their units.

                  简单地说,我需要的是一种方法来分解"每个包含数字的标记,通过大块数字或字母没有分隔符.

                  Simply, what I need is a way to 'explode' each tokens that has number in it by chunk of numbers or letters without delimiter.

                  '123abc' 将是 ['123', 'abc']

                  'abc123' 将是 ['abc', '123']

                  'abc123xyz' 将是 ['abc', '123', 'xyz']

                  等等.

                  在 PHP 中实现它的最佳方法是什么?

                  What is the best way to achieve it in PHP?

                  我发现了一些接近它的东西,但它是 C# 并且专门用于日/月拆分.如何在 C# 中根据字母和数字拆分字符串

                  I found something close to it, but it's C# and spesifically for day/month splitting. How do I split a string in C# based on letters and numbers

                  推荐答案

                  您可以使用 preg_split

                  $string = "Hi, my name is Bob. I m 19yo and 170cm tall";
                  $parts = preg_split("/(,?s+)|((?<=[a-z])(?=d))|((?<=d)(?=[a-z]))/i", $string);
                  var_dump ($parts);
                  

                  匹配数字字母边界时,正则表达式匹配必须为零宽度.字符本身不得包含在匹配中.为此,零宽度环视很有用.

                  When matching against the digit-letter boundary, the regular expression match must be zero-width. The characters themselves must not be included in the match. For this the zero-width lookarounds are useful.

                  http://codepad.org/i4Y6r6VS

                  这篇关于拆分包含字母和数字的字符串,在 PHP 中不被任何特定的分隔符分隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <tfoot id='BJlB9'></tfoot>

                        <i id='BJlB9'><tr id='BJlB9'><dt id='BJlB9'><q id='BJlB9'><span id='BJlB9'><b id='BJlB9'><form id='BJlB9'><ins id='BJlB9'></ins><ul id='BJlB9'></ul><sub id='BJlB9'></sub></form><legend id='BJlB9'></legend><bdo id='BJlB9'><pre id='BJlB9'><center id='BJlB9'></center></pre></bdo></b><th id='BJlB9'></th></span></q></dt></tr></i><div id='BJlB9'><tfoot id='BJlB9'></tfoot><dl id='BJlB9'><fieldset id='BJlB9'></fieldset></dl></div>

                      1. <small id='BJlB9'></small><noframes id='BJlB9'>

                        <legend id='BJlB9'><style id='BJlB9'><dir id='BJlB9'><q id='BJlB9'></q></dir></style></legend>
                            <tbody id='BJlB9'></tbody>

                          • <bdo id='BJlB9'></bdo><ul id='BJlB9'></ul>