File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ next-page: extractor-objects
14
14
previous-page : singleton-objects
15
15
---
16
16
17
- 正则表达式是一类特殊的字符串,可以用来在数据中寻找特定模式. 任何字符串都可以通过调用 ` .r ` 方法来转换成正则表达式
17
+ 正则表达式是一类特殊的字符串,可以用来在数据中寻找特定模式。 任何字符串都可以通过调用 ` .r ` 方法来转换成正则表达式。
18
18
19
19
``` tut
20
20
import scala.util.matching.Regex
@@ -27,9 +27,9 @@ numberPattern.findFirstMatchIn("awesomepassword") match {
27
27
}
28
28
```
29
29
30
- 在上例中, 常量 ` numberPattern ` 是一个 ` Regex ` 类型的实例 ( 正则表达式) , 这里用来确保密码中含有一个数字.
30
+ 在上例中, 常量 ` numberPattern ` 是一个 ` Regex ` 类型的实例( 正则表达式), 这里用来确保密码中含有一个数字。
31
31
32
- 你也可以用圆括号括起多个正则表达式,以便一次寻找多个值.
32
+ 你也可以用圆括号括起多个正则表达式,以便一次寻找多个值。
33
33
34
34
``` tut
35
35
import scala.util.matching.Regex
@@ -49,7 +49,7 @@ val input: String =
49
49
for (patternMatch <- keyValPattern.findAllMatchIn(input))
50
50
println(s"key: ${patternMatch.group(1)} value: ${patternMatch.group(2)}")
51
51
```
52
- 此例中我们从字符串中解析出多组键值对. 每一个匹配值都包含一组子匹配值. 结果如下:
52
+ 此例中我们从字符串中解析出多组键值对。 每一个匹配值都包含一组子匹配值。 结果如下:
53
53
```
54
54
key: background-color value: #A03300
55
55
key: background-image value: url(img
You can’t perform that action at this time.
0 commit comments