Sha256: 10f09a0dce019c7dc0af15cf43953e79ca52840ed611cdc5ba4dea25f3f719ef
Contents?: true
Size: 323 Bytes
Versions: 1
Compression:
Stored size: 323 Bytes
Contents
# this came from # http://reefpoints.dockyard.com/ruby/2011/11/18/convert-ruby-regexp-to-javascript-regex.html class Regexp def to_javascript Regexp.new(inspect.sub('\\A','^').sub('\\Z','$').sub('\\z','$').sub(/^\//,'').sub(/\/[a-z]*$/,'').gsub(/\(\?#.+\)/, '').gsub(/\(\?-\w+:/,'('), self.options).inspect end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_form_with_client_validation-0.0.2 | lib/simple_form_with_client_validation/core_ext/regexp.rb |