diff options
Diffstat (limited to 'lib/uri/mailto.rb')
-rw-r--r-- | lib/uri/mailto.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index bf6b954903..b1c18f4364 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -46,20 +46,22 @@ module URI # hname = *urlc # hvalue = *urlc # header = hname "=" hvalue - HEADER_REGEXP = "(?:[^?=&]*=[^?=&]*)".freeze + header_pattern = "(?:[^?=&]*=[^?=&]*)" + HEADER_REGEXP = /#{header_pattern}/ # headers = "?" header *( "&" header ) # to = #mailbox # mailtoURL = "mailto:" [ to ] [ headers ] - MAILBOX_REGEXP = "(?:[^(),%?=&]|#{PATTERN::ESCAPED})".freeze + mailbox_pattern = "(?:[^(),%?=&]|#{PATTERN::ESCAPED})" + MAILBOX_REGEXP = /#{mailbox_pattern}/ MAILTO_REGEXP = Regexp.new(" \\A - (#{MAILBOX_REGEXP}*?) (?# 1: to) + (#{mailbox_pattern}*?) (?# 1: to) (?: \\? - (#{HEADER_REGEXP}(?:\\&#{HEADER_REGEXP})*) (?# 2: headers) + (#{header_pattern}(?:\\&#{header_pattern})*) (?# 2: headers) )? \\z - ", Regexp::EXTENDED, 'N').freeze + ", Regexp::EXTENDED, 'N') =begin |