Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

AS guide: documents Regexp#multiline?

  • Loading branch information...
commit c63e19c8a0ccca1ad30b90bc262f11919f5397c1 1 parent 23566b0
@fxn fxn authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 railties/guides/source/active_support_overview.textile
25 railties/guides/source/active_support_overview.textile
@@ -1573,6 +1573,31 @@ def recognition_extraction
+h4. +multiline?+
+The method +multiline?+ says whether a regexp has the +/m+ flag set, that is, whether the dot matches newlines.
+%r{.}.multiline? # => false
+%r{.}m.multiline? # => true
+'.').multiline? # => false'.', Regexp::MULTILINE).multiline? # => true
+Rails uses this method in a single place, also in the routing code. Multiline regexps are disallowed for route requirements and this flag eases enforcing that constraint.
+def assign_route_options(segments, defaults, requirements)
+ ...
+ if requirement.multiline?
+ raise ArgumentError, "Regexp multiline option not allowed in routing requirements: #{requirement.inspect}"
+ end
+ ...
h3. Extensions to +Range+
Please sign in to comment.
Something went wrong with that request. Please try again.