http://www.perlmonks.org?node_id=413874

use strict; use warnings; my $test = "{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}="; # All you need to do is to escape the braces print "Yay" if $test =~ /\{[^\{\}]+\}\{[^\{\}]+\}\{[^\{\}]+\}\{[^\{\}] ++\}\{([^\{\}]+)\}\{([^\{\}]+)\}\{[^\{\}]+\}\{[^\{\}]+\}\{[^\{\}]+\}\{ +[^\{\}]+\}=/; # better that is nicer written as (DRY. Dont Repeat Yourself) print "Yay" if $test =~ / (:? \{ # literal left brace [^ \{ \} ]+ # everything but braces \} # literal right brace ){10} # all of the above then times = # followed by a literal equal sign /x; # x ignores whitespace