I have input lines that start with "./" and ".\",my regex works when the line starts with ".\" fails for the other one,I need help to write a regex that fits in both the scenarios?

INPUT:- .\amss\platform\cs\bin\cdep.exe-43041;FILE.flf;//deploy/core/cs/pk/rel +/1.4/bin/cdep.exe - VU_CORE_CS_PK.01.04.00.07.00 : 5 ./modem_proc/build/ms/dmss_flags.min-000197;FILE.flf;//depot/asic/buil +d/ms/dmss_flags.txt - BUILD_MS.00.00.02 : 5 I have the following code which fails when the line starts with "./",h +ow do I modify the below code to suit for both the above inputs? OUTPUT:- KEYS:-//deploy/core/cs/pk/rel/1.4/bin/cdep.exe //depot/asic/build/ms/dmss_flags.txt VALUES:- amss\platform\cs\bin\cdep.exe modem_proc/build/ms/dmss_flags.min my %hash_basebuild_rpf; open my $inputfh, '<', $basebuild_rpf_file or die "could not open $bas +ebuild_rpf_file - $!"; while (my $line = <$inputfh>) { chomp($line); my ($key) = $line =~ /;([^;]+)\s-\s/; print "KEY:$key\n"; my ($value) = $line =~ /\.\\(.*);/; # this line fails when the lin +e starts with "./" print "VALUE:$value\n"; $hash_basebuild_rpf{$key} = $value unless (exists $hash_basebuild_ +rpf{$key}); }

In reply to Regex failing when the line starts with "./" by perl_mystery

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.