<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -150,7 +150,8 @@ module ActionView
       # You can also supply an array of TimeZone objects
       # as +priority_zones+, so that they will be listed above the rest of the
       # (long) list. (You can use TimeZone.us_zones as a convenience for
-      # obtaining a list of the US time zones.)
+      # obtaining a list of the US time zones, or a Regexp to select the zones
+      # of your choice)
       #
       # Finally, this method supports a &lt;tt&gt;:default&lt;/tt&gt; option, which selects
       # a default TimeZone if the object's time zone is +nil+.
@@ -164,6 +165,8 @@ module ActionView
       #
       #   time_zone_select( &quot;user&quot;, 'time_zone', [ TimeZone['Alaska'], TimeZone['Hawaii'] ])
       #
+      #   time_zone_select( &quot;user&quot;, 'time_zone', /Australia/)
+      #
       #   time_zone_select( &quot;user&quot;, &quot;time_zone&quot;, TZInfo::Timezone.all.sort, :model =&gt; TZInfo::Timezone)
       def time_zone_select(object, method, priority_zones = nil, options = {}, html_options = {})
         InstanceTag.new(object, method, self, nil, options.delete(:object)).to_time_zone_select_tag(priority_zones, options, html_options)
@@ -292,7 +295,8 @@ module ActionView
       # selected option tag. You can also supply an array of TimeZone objects
       # as +priority_zones+, so that they will be listed above the rest of the
       # (long) list. (You can use TimeZone.us_zones as a convenience for
-      # obtaining a list of the US time zones.)
+      # obtaining a list of the US time zones, or a Regexp to select the zones
+      # of your choice)
       #
       # The +selected+ parameter must be either +nil+, or a string that names
       # a TimeZone.
@@ -311,6 +315,9 @@ module ActionView
         convert_zones = lambda { |list| list.map { |z| [ z.to_s, z.name ] } }
 
         if priority_zones
+	  if priority_zones.is_a?(Regexp)
+            priority_zones = model.all.find_all {|z| z =~ priority_zones}
+	  end
           zone_options += options_for_select(convert_zones[priority_zones], selected)
           zone_options += &quot;&lt;option value=\&quot;\&quot; disabled=\&quot;disabled\&quot;&gt;-------------&lt;/option&gt;\n&quot;
 </diff>
      <filename>actionpack/lib/action_view/helpers/form_options_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1300,6 +1300,24 @@ COUNTRIES
                  html
   end
 
+  uses_mocha &quot;time_zone_select_with_priority_zones_as_regexp&quot; do
+    def test_time_zone_select_with_priority_zones_as_regexp
+      @firm = Firm.new(&quot;D&quot;)
+      MockTimeZone.any_instance.stubs(:=~).returns(true,false,false,true,false)
+
+      html = time_zone_select(&quot;firm&quot;, &quot;time_zone&quot;, /A|D/)
+      assert_dom_equal &quot;&lt;select id=\&quot;firm_time_zone\&quot; name=\&quot;firm[time_zone]\&quot;&gt;&quot; +
+                   &quot;&lt;option value=\&quot;A\&quot;&gt;A&lt;/option&gt;\n&quot; +
+                   &quot;&lt;option value=\&quot;D\&quot; selected=\&quot;selected\&quot;&gt;D&lt;/option&gt;&quot; +
+                   &quot;&lt;option value=\&quot;\&quot; disabled=\&quot;disabled\&quot;&gt;-------------&lt;/option&gt;\n&quot; +
+                   &quot;&lt;option value=\&quot;B\&quot;&gt;B&lt;/option&gt;\n&quot; +
+                   &quot;&lt;option value=\&quot;C\&quot;&gt;C&lt;/option&gt;\n&quot; +
+                   &quot;&lt;option value=\&quot;E\&quot;&gt;E&lt;/option&gt;&quot; +
+                   &quot;&lt;/select&gt;&quot;,
+                   html
+    end
+  end
+
   def test_time_zone_select_with_default_time_zone_and_nil_value
      @firm = Firm.new()
      @firm.time_zone = nil</diff>
      <filename>actionpack/test/template/form_options_helper_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -201,6 +201,12 @@ module ActiveSupport
       result
     end
 
+    # Compare #name and TZInfo identifier to a supplied regexp, returning true
+    # if a match is found.
+    def =~(re)
+      return true if name =~ re || MAPPING[name] =~ re
+    end
+
     # Returns a textual representation of this time zone.
     def to_s
       &quot;(GMT#{formatted_offset}) #{name}&quot;</diff>
      <filename>activesupport/lib/active_support/values/time_zone.rb</filename>
    </modified>
    <modified>
      <diff>@@ -250,6 +250,13 @@ class TimeZoneTest &lt; Test::Unit::TestCase
     assert zone1 == zone1
   end
 
+  def test_zone_match
+    zone = ActiveSupport::TimeZone['Eastern Time (US &amp; Canada)']
+    assert zone =~ /Eastern/
+    assert zone =~ /New_York/
+    assert zone !~ /Nonexistent_Place/
+  end
+
   def test_to_s
     assert_equal &quot;(GMT+03:00) Moscow&quot;, ActiveSupport::TimeZone['Moscow'].to_s
   end</diff>
      <filename>activesupport/test/time_zone_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>029a7455846cde2654958358a6fe354f236ade35</id>
    </parent>
  </parents>
  <author>
    <name>Ernie Miller</name>
    <email>ernie@metautonomo.us</email>
  </author>
  <url>http://github.com/rails/rails/commit/d0092dc44d580f4179308c7394d9023098406f79</url>
  <id>d0092dc44d580f4179308c7394d9023098406f79</id>
  <committed-date>2008-06-29T11:37:07-07:00</committed-date>
  <authored-date>2008-06-28T19:27:32-07:00</authored-date>
  <message>Added support for regexp matching of priority zones in time_zone_select [#195 state:resolved]</message>
  <tree>d5ec77bbd249cd8bb1c1ae0efd877f179c656494</tree>
  <committer>
    <name>gbuesing</name>
    <email>gbuesing@gmail.com</email>
  </committer>
</commit>
