Re: Text parsing and substitution
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Fri, 19 May 2006 16:19:53 +0200
maheshpop1@xxxxxxxxx schreef:
change the following sentence
"1:action=commit:user=joe:date=2005-02-02:"
"2:action=checkout:user=mark:date=2005-02-03:"
to something like
" 1. Commits by user Joe on date 2005-02-02 "
" 2. Checkouts by user Joe on date 2005-02-03"
This assumes that the fields are allways in the same order:
#!/usr/bin/perl
use strict;
use warnings;
while ( <DATA> )
{
s{ ^ ([^:]+)
: (action) = ([^:]+)
: (user) = ([^:]+)
: (date) = ([^:]+)
:
}
{$1. \u$3s by $4 \u$5 on $6 $7}x
and print
}
__DATA__
1:action=commit:user=joe:date=2005-02-02:
2:action=checkout:user=mark:date=2005-02-03:
--
Affijn, Ruud
"Gewoon is een tijger."
.
- References:
- Text parsing and substitution
- From: maheshpop1
- Text parsing and substitution
- Prev by Date: Re: printing css
- Next by Date: Re: why doesn't this eval print ?
- Previous by thread: Re: Text parsing and substitution
- Next by thread: UTF-8 without external modules on Perl 5.0
- Index(es):
Relevant Pages
|