Ok so i dont understand regex checker works in ruby
=~
1.9.2p290 :009 > url = "/myurl"
=> "/myurl"
1.9.2p290 :010 > url =~ %r{^/.*/found/\d+$}i
=> nil
1.9.2p290 :011 > url = "/myurl/found/1"
=> "/myurl/found/1"
1.9.2p290 :012 > url =~ %r{^/.*/found/\d+$}i
=> 0
It seems to return a value of something if found otherwise it returns nil …but i dont know for sure
….where is the documentation for this anywhere…i tried to google for this and no luck at all…any help would be appreciated
When it matches, it returns the position of the beginning of the match. Otherwise, returns nil. The
0in your last example means that the substring that matched the regex starts from position0of the original string.