in reply to Regex help!

this is Perl

DB<110> @a= ('USE 28-000009 FLASH CARD, IODUO, 1280GB, MLC, FUSION +IO, FS3-204-641-CS-0001' , 'Disk - HD 500GB 2.5 SATA (00X3Y)', 'Disk +- HD 500.31415926GB 2.5 SATA (00X3Y)') => ( "USE 28-000009 FLASH CARD, IODUO, 1280GB, MLC, FUSION IO, FS3-204-64 +1-CS-0001", "Disk - HD 500GB 2.5 SATA (00X3Y)", "Disk - HD 500.31415926GB 2.5 SATA (00X3Y)", ) DB<111> print / (\d+(?:\.\d+)?)GB\W/,"\n" for @a 1280 500 500.31415926

and sed ain't no PCRE!

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^2: Regex help!
by lpanokarren (Novice) on Jun 08, 2013 at 01:05 UTC

    Thanks a ton Rolf! although, do you know if your code works for this input?

    'Disk - HD 600GB 15K'

    I used the regex you provided, and it seems for this the output is all 0s - unless I am doing something wrong

      > unless I am doing something wrong

      you are doing something wrong!

      Cheers Rolf

      ( addicted to the Perl Programming Language)

        I was doing a lot of things wrong - thanks guys (Rolf particularly for the quick response) - I need to read up perl regular expressions more as I clearly suck at it

      I used the regex you provided, and it seems for this the output is all 0s - unless I am doing something wrong

      But you don't show what you're doing