Re: Text parsing and substitution



maheshpop1@xxxxxxxxx wrote:
: Hi guys,

: I am doing this module where I am gonna 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"


Check whether all your data follow the same pattern and obey the same
constraints. Apparently you'r doing something in fields here, so:

$rawtext="1:action=commit:user=joe:date=2005-02-02:";
($no,$rawaction,$rawuser,$rawdate)=split(/:/,$rawtext);

# Treat each raw element like this:
($nil,$user)=split(/=/,$rawuser);

# Keep a hash for full user names (and for actions as well):

%users(
"joe" => "Joe",
"dan" => "Daniel",
...
);

# Build your phrase in free English, like:

print "On $date, user $users{$user} $actions{$action}...";

Hth,

Oliver.


--
Dr. Oliver Corff e-mail: corff@xxxxxxxxxxxxxxxxxx
.



Relevant Pages

  • Re: hash recursion shortcut impossible?
    ... The PGP manual recommended to choose a "good" pass phrase for the secret ... The last hash will be stored with the secret key. ... how many iterations to make for each pass phrase. ...
    (sci.crypt)
  • Re: expensive password hash
    ... >>phrase or he will not detect when he guesses the right pass phrase. ... I fail to see how this is done in your design. ... The hash over the buffef full with hashes is used to ... In this design the number of iterations or the time to waste is not ...
    (sci.crypt)
  • Re: expensive password hash
    ... > phrase or he will not detect when he guesses the right pass phrase. ... >> memory intensive. ... But we we assume that a hash ... > hash instead of aes, but I guessed aes would be quicker to ...
    (sci.crypt)
  • Re: Newbie - Are You Sure Thats the Correct Pass Phrase?
    ... The pass phrase is run through PKCS # 5 algo 2. ... produces the crypto key for certain columns in database accesses. ... So the passphrase is not ... and a hash to generate the encryption key. ...
    (sci.crypt)
  • Re: Newbie - Are You Sure Thats the Correct Pass Phrase?
    ... The pass phrase is run through PKCS # 5 algo 2. ... produces the crypto key for certain columns in database accesses. ... Sorry, my mistake, I thought passphrase was used when the user signs in. ... and a hash to generate the encryption key. ...
    (sci.crypt)