Thank you for your answers. OK, so this was very simple once I tried it out on a very small piece of code instead of what I was working on. I did not realize that you could just stick {} pretty much anywhere you want. Example below, in case anyone is interested.
#!/usr/bin/perl use strict; use warnings; use re::engine::TRE max_cost => 5; my $seq1 = "TTTTACGAGAGAATATGTTAGGTGAAGGAACCTCTATCTGAGAGAAAAA"; my $seq2 = "TTTTGAGCTCGTTGTCGATCCGAGGTACTTTTGAATCCGCAGTTTCTTG"; if ("A pearl is a hard object produced ..." =~ /\(Perl\)/i) { print "$1\n"; } if (($seq2 =~ /GTTGTTCGATCCAGGTAC/) && ($seq1 =~ /ACGAGAGATAGATGA/)) { print "Have a match\n"; }
This will print 'pearl' and "Have a match".
#!/usr/bin/perl use strict; use warnings; my $seq1 = "TTTTACGAGAGAATATGTTAGGTGAAGGAACCTCTATCTGAGAGAAAAA"; my $seq2 = "TTTTGAGCTCGTTGTCGATCCGAGGTACTTTTGAATCCGCAGTTTCTTG"; if ("A pearl is a hard object produced ..." =~ /\(Perl\)/i) { print "$1\n"; } { use re::engine::TRE max_cost => 5; if (($seq2 =~ /GTTGTTCGATCCAGGTAC/) && ($seq1 =~ /ACGAGAGATAGATGA/)) { print "Have a match\n"; } }
This will only print out "Have a match".
In reply to Re^2: restrict use of regex module in script
by pmpmmpmp
in thread restrict use of regex module in script
by pmpmmpmp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |