From 5795765011c04e3d35feec910f6083038ad430a2 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 28 Mar 2013 12:07:25 +0000 Subject: [PATCH] handle easy regx expressions git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15704 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index f96d134fd..bf31071e1 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -2280,17 +2280,16 @@ sub getNodeAttribs #skip undefined values, save time next; } - if ($datum->{$attrib} =~ /^\/[^\/]*\/[^\/]*\/$/) { my $exp = substr($datum->{$attrib}, 1); chop $exp; my @parts = split('/', $exp, 2); - my $retval = $node; + my $retval = $node; $retval =~ s/$parts[0]/$parts[1]/; $datum->{$attrib} = $retval; } - elsif ($datum->{$attrib} =~ /^\|.*\|.*\|$/) + elsif ($datum->{$attrib} =~ /^\|.*\|$/) { #Perform arithmetic and only arithmetic operations in bracketed issues on the right. @@ -2300,6 +2299,14 @@ sub getNodeAttribs my $exp = substr($datum->{$attrib}, 1); chop $exp; my @parts = split('\|', $exp, 2); + my $arraySize = @parts; + if ($arraySize < 2) { # easy regx, generate lhs from node + my $lhs; + my @numbers = $node =~ m/[\D0]*(\d+)/g; + $lhs = '[\D0]*(\d+)' x scalar(@numbers); + $lhs .= '.*$'; + unshift(@parts,$lhs); + } my $curr; my $next; my $prev;