回答編集履歴

2

最後のデータ

2019/05/30 10:16

投稿

yambejp
yambejp

スコア114883

test CHANGED
@@ -14,11 +14,11 @@
14
14
 
15
15
  $str = "[2019-05-30_17:57:12.234] [testPG] [info] [test,hogehohe,20190530175712234]";
16
16
 
17
- $pattern="/(?<=[).*?(?=])/mis";
17
+ $pattern="/(?!.*?[.*?])(?<=[).*?(?=])/";
18
18
 
19
- if(preg_match_all($pattern,$str,$match)){
19
+ if(preg_match($pattern,$str,$match)){
20
20
 
21
- print $match[0][count($match[0])-1];
21
+ print $match[0];
22
22
 
23
23
  }
24
24
 

1

ちょうせい

2019/05/30 10:16

投稿

yambejp
yambejp

スコア114883

test CHANGED
@@ -5,3 +5,21 @@
5
5
 
6
6
 
7
7
  によってやり方が変わります
8
+
9
+
10
+
11
+ # sample
12
+
13
+ ```PHP
14
+
15
+ $str = "[2019-05-30_17:57:12.234] [testPG] [info] [test,hogehohe,20190530175712234]";
16
+
17
+ $pattern="/(?<=[).*?(?=])/mis";
18
+
19
+ if(preg_match_all($pattern,$str,$match)){
20
+
21
+ print $match[0][count($match[0])-1];
22
+
23
+ }
24
+
25
+ ```