jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
My first thought was $quota_string =~ s/\s+/ /g; $quota_string =~ s/:/:\n/; and then try to match the whitespace /words and put a new line in front of it $quota_string =~ s/\s{1}\/$1\n/g; and then convert all the \n to <tr> and all the spaces to <td> I haven't entirely worked all the bugs out of this idea yet, because the mildly complicated regex doesn't work....Disk quotas for testuser (uid 65530): Filesystem usage quota limit timeleft files quota limit + timeleft /var/mail 1394 15360 16384 0 0 0 + /home 255999 307200 308224 34 0 0
And then there is also the problem of, when converting all the whitespaces to one space the files field shifts over to the timeleft field... anyone have any thoughts on how to insert perhaps a "-" if there is nothing there?
I was considering something as hidous as this to help but....
that is ugly as sin and........ yeah....doesn't work...my $ugly_regex = '! / # match / \w*? # match optional minimum word characters (/dir +) /? # match single optional / \w*? # match optional minimum word characters (/dir +/dir) /? # match single optional / \w*? # match optional minimum word characters (/dir +/dir/dir) /? # match single optional / \w*? # match optional minimum word characters (/dir +/dir/dir/dir) \s? # match a single optional whitespace \d+? # match 1 or more numbers \s? # match a single optional whitespace \d+? # match 1 or more numbers \s? # match a single optional whitespace \d+? # match 1 or more numbers \s? # match a single optional whitespace \d+? # match 1 or more numbers \s? # match a single optional whitespace \d+? # match 1 or more numbers \s? # match a single optional whitespace \d+? # match 1 or more numbers \s? # match a single optional whitespace \d*? # match 0 or more numbers \s? # match a single optional whitespace \d*? # match 0 or more numbers !x';
Update: By remote I mean through an telnet/ssh session emulated by either Net::Telnet or Net::SSH::Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: patern matching whitespace, / and others
by revdiablo (Prior) on Mar 01, 2004 at 19:20 UTC | |
by jcpunk (Friar) on Mar 01, 2004 at 23:22 UTC | |
|
Re: patern matching whitespace, / and others
by esskar (Deacon) on Mar 01, 2004 at 16:52 UTC | |
by jcpunk (Friar) on Mar 01, 2004 at 17:11 UTC | |
by esskar (Deacon) on Mar 01, 2004 at 17:21 UTC | |
|
Re: patern matching whitespace, / and others
by Roy Johnson (Monsignor) on Mar 01, 2004 at 18:34 UTC |