对 rubular 不是很熟悉,想知道如何使用 Ruby 正则表达式从中提取“postreview-should-be-the-cause”
"{\"source_url\"=>\"http://testing.com/projects/postreview-should-be-the-cause\"}"
我得到的最好的是
check_user = url.split(/\b(\w+)\b/)
=> ["{\"", "source_url", "\"=>\"", "http", "://", "localhost", ":", "3000", "/", "projects", "/", "postreview", "-", "should", "-", "be", "-", "the", "-", "cause", "\"}"]
还在尝试各种方法。提前致谢。