in reply to Re^2: Constructing a hash - why isn't my regex matching anything
in thread Constructing a hash - why isn't my regex matching anything

Yes, I know, do you have a question?
  • Comment on Re^3: Constructing a hash - why isn't my regex matching anything

Replies are listed 'Best First'.
Re^4: Constructing a hash - why isn't my regex matching anything
by perl_mystery (Beadle) on Dec 19, 2010 at 09:05 UTC

    why is $key and $match not matching anything?what change should I do in regex to match them?

      why is $key and $match not matching anything?

      Because there is nothing to match. An empty line, all whitespace line, is empty :) It has no dots. It has no dashes, semicolons, slashes. Your regex won't match. :D

      what change should I do in regex to match them?

      Allow for the possibility of failure,ie test for success, just like this guy shows

        For the input line shown below,the regex is still no matching,I couldnt find anything wrong?Need your input

        INPUT LINE:\root\edit\perl\scripts\scripths\sec\inc\script_auth_pap.h- +113115;perforcePLF.txt;//programfiles/documents/data/lookup/script_au +th_pap.h - label_scriptHS_source.01.16.00 : 5 if (my ($key, $value) = $line =~ /\.\\(.+?)-\d+;.+?;(.+?)\s-\s/) { }