回答編集履歴
2
テキスト修正
answer
CHANGED
@@ -6,11 +6,13 @@
|
|
6
6
|
/\ba\b/g
|
7
7
|
```
|
8
8
|
|
9
|
-
がよいかと思います。 `\b` は単語の境界(
|
9
|
+
がよいかと思います。 `\b` は単語の境界(Word Boundaries)を意味します。
|
10
10
|
|
11
11
|
以下、使用例です。
|
12
12
|
|
13
13
|
- **動作確認用サンプル:** [https://codepen.io/jun68ykt/pen/GRKGMvQ?editors=0001](https://codepen.io/jun68ykt/pen/GRKGMvQ?editors=0001)
|
14
|
+
|
15
|
+
- **参考:** regular-expressions.info: [Word Boundaries](https://www.regular-expressions.info/wordboundaries.html)
|
14
16
|
|
15
17
|
以上、参考になれば幸いです。
|
16
18
|
|
1
テキスト修正
answer
CHANGED
@@ -12,4 +12,13 @@
|
|
12
12
|
|
13
13
|
- **動作確認用サンプル:** [https://codepen.io/jun68ykt/pen/GRKGMvQ?editors=0001](https://codepen.io/jun68ykt/pen/GRKGMvQ?editors=0001)
|
14
14
|
|
15
|
-
以上、参考になれば幸いです。
|
15
|
+
以上、参考になれば幸いです。
|
16
|
+
|
17
|
+
### 追記
|
18
|
+
|
19
|
+
te2jiさんからのコメントにお応えするのと、 `an` にも対応させると以下になります。
|
20
|
+
|
21
|
+
```javascript
|
22
|
+
/\ban?\b/gi
|
23
|
+
```
|
24
|
+
- **動作確認用サンプル:** [https://codepen.io/jun68ykt/pen/gOYKGvK?editors=0011](https://codepen.io/jun68ykt/pen/gOYKGvK?editors=0011)
|