in reply to Re: Strip non-numeric
in thread Strip non-numeric

Ok, thanks. Also did have one more question about this -- I didn't take into consideration about valid non-numeric (only decmial). So for example, 1a2b3.4c5d6e, I would want 123.456, not just 123456 -- tried a few combinations, but nothing yet. I'm missing something obvious I know ;) Any pointers?

Replies are listed 'Best First'.
Re: Strip non-numeric
by Abigail-II (Bishop) on Jan 14, 2003 at 09:46 UTC
    It always helps if you are specific. Noone enjoys a game of "How do I do X?", "This is how you do X", "But I don't really want to do X, I want to do Y".

    So, from 1a2b3.4c5d6e, you want 123.456. But what if you have 1a2b.3c4d.5e6f? What do you want then?

    Abigail

Re: Strip non-numeric
by Hofmator (Curate) on Jan 14, 2003 at 08:48 UTC
    If I understand you correctly, you want to remove floating point numbers as well, together with normal integer numbers but not if they are part of a normal word (like 'HAL1'), don't you?

    Then maybe you should have a look at Regexp::Common. Together with putting whitespace around the regex you should get it to work.

    -- Hofmator