Conditional statements in logstash.conf

The if statement looks OK. If I run

input { generator { count => 1 lines => [ '' ] } }
filter {
    mutate { add_field => { "source" => "someword_12_someword0_CH1_AbC_GO-0123456789_-;;;-1234_123456.xml" } }
    if [source] =~ /someword_\d{2,3}_someword\d{1}_CH\d_\S{1,3}\d{0,1}_GO-\d{10}_\d{0,2}-\D{3}-\d{4}_\d{6}.xml/ {
        mutate { add_field => { "matched" => true } }
    }
}

then the [matched] field does get added.