回答編集履歴

1

調整

2022/04/07 08:45

投稿

yambejp
yambejp

スコア117752

test CHANGED
@@ -1,5 +1,5 @@
1
1
  ```javascript
2
2
  const text = 'before[123]';
3
- const rep = text.replace(/(?<=before\[)[0-9]+(?=\])/g,x=>parseInt(x)+1);
3
+ const rep = text.replace(/(?<=before\[)\d+(?=\])/g,x=>parseInt(x)+1);
4
4
  console.log(rep);
5
5
  ```