本文介绍了如何选择空白模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
\s \ {{Space} \p {javaWhitespace}
在 Oracle Pattern文档有三种匹配空格的不同模式的描述:
In the Oracle Pattern documentation there is the description of three different pattern for matching whitespace :
我是想知道每个人的特殊性以及如何选择合适的人。 我刚注意到 \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.
更多推荐
如何选择空白模式?
发布评论