I had like to pass the following string via Regex to extract the domain name and the numeric value next to ms.
stackoverflow.com : [0], 96 bytes, 223 ms (223 avg, 0% loss)
I need:
stackoverflow.com , 223
Any help will be much appreciated.
Use following regex
:
(\w+\.[a-zA-Z]{2,3}).+?(\d+)\s+ms
Explanation
()
: Capturing group\w+
: Match any alphanumeric characters any number of times\.
: Match .
literal[a-zA-Z]{2,3}
: Match the two or three alphabets.+?
: Matches any characters except linebreak\d+
: Matches any number of digits