Search code examples
rubyregexrspecwebmock

How to use webmock regex matcher?


How to match a URL like:

http://www.example.com/foo/:id/bar
http://www.example.com/foo/1/bar
http://www.example.com/foo/999/bar

stub_request(:post, "www.example.com")


Solution

  • http://www\..*?\.com/foo/\d+/bar should work for you.