1
y at-il une méthode RoR qui peut fonctionner comme la fonction preg_match_all() php?comment peut-on utiliser preg_match_all() dans RoR
y at-il une méthode RoR qui peut fonctionner comme la fonction preg_match_all() php?comment peut-on utiliser preg_match_all() dans RoR
Utilisez scan:
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"]]
il y a un bon article ici: http://railsforphp.com/2008/01/17/regular-expressions-in-ruby/
je veux que la sortie [ '[email protected]', '[email protected]'] – ashok