回答編集履歴
2
typo
answer
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
$ echo " test " | egrep '^(test|sample|)+$'
|
|
17
17
|
$ echo "testtest" | egrep '^(test|sample|)+$'
|
|
18
18
|
testtest
|
|
19
|
+
$ echo "" | egrep '^(test|sample|)+$'
|
|
20
|
+
|
|
19
21
|
$ echo "testtestsample" | egrep '^(test|sample|)+$'
|
|
20
22
|
testtestsample
|
|
21
23
|
$ echo "testtestsampletest" | egrep '^(test|sample|)+$'
|
1
追記
answer
CHANGED
|
@@ -4,4 +4,20 @@
|
|
|
4
4
|
$ echo "teratail" | egrep '^(test|sample|)+$'
|
|
5
5
|
$ echo "test" | egrep '^(test|sample|)+$'
|
|
6
6
|
test
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
----
|
|
10
|
+
|
|
11
|
+
> 色々と試してみれば、一発ですね。
|
|
12
|
+
|
|
13
|
+
では、あとでみたヒトのために追記しておきます。
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
$ echo " test " | egrep '^(test|sample|)+$'
|
|
17
|
+
$ echo "testtest" | egrep '^(test|sample|)+$'
|
|
18
|
+
testtest
|
|
19
|
+
$ echo "testtestsample" | egrep '^(test|sample|)+$'
|
|
20
|
+
testtestsample
|
|
21
|
+
$ echo "testtestsampletest" | egrep '^(test|sample|)+$'
|
|
22
|
+
testtestsampletest
|
|
7
23
|
```
|