in reply to Re^2: Extract pattern from string
in thread Extract pattern from string

That actually did not work. I modified the expression to this:
    $str =~ /Protocol ((?:No\.|Number?) )?([A-Z0-9]{12})/;

BTW: The reason the modified regex didn't work is that you just moved the extraneous and confounding capturing parentheses from the inside to the outside of the group instead of making them non-capturing:  (?:(No\.|Number)? )? to  ((?:No\.|Number?) )?