in reply to Issues With Regex

OK, figured it out. My $BE_temp was being set by capturing the output of a MySQL query. I changed the output format of the query with the "-E" flag. I was then able to RE the LSV and LSN appropriately. Code from my test script and output below...

$output = $cli->cmd("/usr/mysql/bin/mysql -E -uuser -ppass -D targetdb + -e \"select * from table;\" | tail -2"); $temp = $output; print "\ntemp\n----------------\n$temp\n"; my ($LSV, $LSN) = $temp =~ m/^.*: (\w+).*: (\w+)/s; print "LSV: $LSV\nLSN: $LSN\n";

Results

temp ---------------- version_name: dsmgt_03_03 schema_name: dsmgt_03 LSV: dsmgt_03_03 LSN: dsmgt_03

Replies are listed 'Best First'.
Re^2: Issues With Regex
by AnomalousMonk (Archbishop) on Jan 08, 2014 at 17:46 UTC
    my ($LSV, $LSN) = $temp =~ m/^.*: (\w+).*: (\w+)/s;
    print "LSV: $LSV\nLSN: $LSN\n";

    This still has the problem (IMHO) that the success of the match is not tested before using the 'results' of the match. Please see my reply above.