1
preg_match_all() PHP 함수와 동일하게 동작 할 수있는 RoR 메소드가 있습니까?우리는 어떻게 preg_match_all()을 RoR에서 사용할 수 있습니까
preg_match_all() PHP 함수와 동일하게 동작 할 수있는 RoR 메소드가 있습니까?우리는 어떻게 preg_match_all()을 RoR에서 사용할 수 있습니까
사용 검사 :
string = '[email protected]; [email protected]'
result = string.scan(/([a-z0-9_.-]+)@([a-z0-9-]+)\.[a-z.]+/i)
p result.size
# => 2
p result
# => [["joe", "example"], ["walter", "example"]]
여기에 좋은 기사가 : http://railsforphp.com/2008/01/17/regular-expressions-in-ruby/
내가 같은 출력을 원하는 [ '[email protected]', '[email protected]'] – ashok