【发布时间】:2015-03-10 23:41:27
【问题描述】:
对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", "\"}"]
还在尝试各种方法。提前致谢。
【问题讨论】: