Why does this work on Rubular.com but not in Ruby code? What am I doing wrong?
Source string
Running 1s test @ http://192.168.0.2:8000\n 8 threads and 256 connections\n Thread Stats Avg Stdev Max +/- Stdev\n Latency 2.08ms 3.91ms 61.86ms 92.89%\n Req/Sec 23.80k 10.45k 60.63k 74.70%\n Latency Distribution\n 50% 1.10ms\n 75% 1.59ms\n 90% 4.03ms\n 99% 22.04ms\n 197510 requests in 1.10s, 29.76MB read\nRequests/sec: 179561.40\nTransfer/sec: 27.06MB
Ruby regex
output.match("Requests\/sec: (.*)\\n")
Result
Requests/sec: 176706.95\nTransfer/sec: 26.63MB", "warnings": []}
If I test it on http://rubular.com I get (which is what I want):
179561.40
I get the same result as @zph. Can you post the full code that leads to your result?
My IRB output is below. I'm using Ruby 2.1.1p76