lib/cureutils/cli.rb in cureutils-0.1.1 vs lib/cureutils/cli.rb in cureutils-0.1.2
- old
+ new
@@ -208,10 +208,13 @@
def pregex2regex(regex, br_flg = false)
this_regex = regex.dup
br_ex = br_flg ? '' : '?:'
%w(girl_name human_name precure_name cast_name color).each do |attr|
expression = '\[:' + attr + ':\]'
- precures_ex = cure_list(attr.to_sym).join('|')
+ precures_ex = cure_list(attr.to_sym).each do |elem_str|
+ # Escape for cure princes.
+ elem_str.gsub(/\(/, '\(').gsub(/\)/, '\)')
+ end.join('|')
replaced = "(#{br_ex}#{precures_ex})"
this_regex.gsub!(/#{expression}/, replaced)
end
this_regex
end