如何选择空白模式?

编程入门 行业动态 更新时间:2024-10-28 20:30:20
本文介绍了如何选择空白模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在 Oracle Pattern文档有三种匹配空格的不同模式的描述:

In the Oracle Pattern documentation there is the description of three different pattern for matching whitespace :

  • \s
  • \ {{Space}
  • \p {javaWhitespace}
  • 我是想知道每个人的特殊性以及如何选择合适的人。 我刚注意到 \p {javaWhitespace} 包含更多空格类型。

    I'm wondering what are the specificity of each and how to know how to choose the right one. I've just noticed that \p{javaWhitespace} include more space type.

    推荐答案

    我宁愿使用第一个。

    • 紧凑型
    • 在许多其他语言中,以及在regexp理论中使用相同的符号
    • \p {javaWhitespace} include FILE SEPARATOR , GROUP SEPARATOR 等...参见 this 。在不需要这些时使用它可能会让其他人感到困惑。
    • 一般来说,我希望其他程序员知道 \s 是什么虽然我希望他们仔细检查 \p {javaWhitespace} 的确切定义。您不希望如此,因为它会降低代码清晰度并在调试过程中增加不必要的负担。
    • It is compact
    • It is the same notation in many other languages, as well as in theory of regexp
    • \p{javaWhitespace} include FILE SEPARATOR, GROUP SEPARATOR,etc... see this. Using it when these are not needed may confuse somebody else.
    • In general I would expect another programmer to know what \s is while I'll expect them to double check what is the exact definition of \p{javaWhitespace}. You don't want that, as it diminish code clarity and add unnecessary burden during debugging.

    更多推荐

    如何选择空白模式?

    本文发布于:2023-10-30 13:34:53,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1543004.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如何选择   空白   模式

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!