I'm assuming you can process the relevant files for their contents, so the problem is essentially the substitution:

c:\@Work\Perl\monks>perl -wMstrict -le "my %hid = ( '1541' => '+12507741234', '926' => '+12505801234', '927' => '+17789701234', '970' => '+16137941234', ); ;; my ($rx_hid) = map qr{ (?<! \d) (?: $_) (?! \d) }xms, join '|', map quotemeta, reverse sort keys %hid ; print $rx_hid; ;; my $msg = join qq{\n}, 'handle_id = 1541 Sent Fri Mar 23 13:41:02 2018', 'text = Hi Partner: Called your house & you are at a mtg.', 'handle_id = 1541 Received Fri Mar 23 16:12:25 2018', 'text = I got you bud', 'handle_id = 970 Sent Fri Mar 23 16:13:56 2018', 'text = Please pickup milk.', ''; print qq{[[$msg]]}; ;; $msg =~ s{ (?i) handle_id \s* = \s* ($rx_hid) } {id = $hid{$1}}xmsg; print qq{<<$msg>>}; " (?msx-i: (?<! \d) (?: 970|927|926|1541) (?! \d) ) [[handle_id = 1541 Sent Fri Mar 23 13:41:02 2018 text = Hi Partner: Called your house & you are at a mtg. handle_id = 1541 Received Fri Mar 23 16:12:25 2018 text = I got you bud handle_id = 970 Sent Fri Mar 23 16:13:56 2018 text = Please pickup milk. ]] <<id = +12507741234 Sent Fri Mar 23 13:41:02 2018 text = Hi Partner: Called your house & you are at a mtg. id = +12507741234 Received Fri Mar 23 16:12:25 2018 text = I got you bud id = +16137941234 Sent Fri Mar 23 16:13:56 2018 text = Please pickup milk. >>
See also haukex's Building Regex Alternations Dynamically.


In reply to Re: Search and replace from one list to another by AnomalousMonk
in thread Search and replace from one list to another by NicheArchitecture

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.