I have a string as below:
53 12/Feb/2022 11:12:08 POST https 200 [1044ms]
I want to get the number in the text [xxxms]
-> 1044
I use regex \d ms
, the result is 1044ms
, but I want to get only the number.
Please help me with this issue.
CodePudding user response:
If your regex engine/tool support lookarounds, you could use:
(?<=\[)\d (?=\w \])
Demo
CodePudding user response:
You can get the value without lookarounds using a capture group:
\[(\d )ms]
\[
Match[
(\d )
Capture 1 digits in group 1ms]
match literally