= Python Challenge -- Level 3 -- Solution = ==== Code ==== {{{ #!d import tango.io.Stdout; import tango.text.Regex; void main () { char[] text = ""; Regex pattern = Regex("[^A-Z]([A-Z]{3}([a-z])[A-Z]{3})[^A-Z]"); foreach (Regex match; pattern.search(text)) Stdout.print(match.match(2)); Stdout.flush(); } }}} ==== Explanation ==== {{{ #!d char[] text = ""; }}} The source text from the challenge page should be put between the quotes. {{{ #!d Regex pattern = Regex("[^A-Z]([A-Z]{3}([a-z])[A-Z]{3})[^A-Z]"); }}} Create a new regular expression that does the following things: * {{{ [^A-Z] }}} * The character must not be an uppercase letter. * {{{ [A-Z]{3} }}} * There must be three uppercase letters in a row. * {{{ [a-z] }}} * The character must be a lowercase letter. * {{{ [A-Z]{3} }}} * There must be three uppercase letters in a row. * {{{ [^A-Z] }}} * The character must not be an uppercase letter. {{{ #!d foreach (Regex match; pattern.search(text)) }}} For every match of the pattern, execute the following code. {{{ #!d Stdout.print(match.match(2)); Stdout.flush(); }}} Print the second tagged statement to the screen. The tagged statement are delimited by the parenthesis. Upon completion, the data is flushed.