sub transform_string_to_optimal_matching_regex { my $given_string = shift; my $regex = ''; my $optimal_solution_found = 0; while(! $optimal_solution_found ) { # # construct optimal regex by some # stochastic algorithm, possibly # long running Monte Carlo-solver # } return $regex; }