in reply to Re: REGEX Help
in thread REGEX Help

Thanks a lot.
The second problem got resolved but the first issue still
persists. What could be missing in this solution


$original_text="Olympus xModel 3.1mp"; $original_text=~ s/(><=\d)mp\b//g; print "\n$original_text";
Regards Habib

Replies are listed 'Best First'.
Re^3: REGEX Help
by GrandFather (Saint) on Jun 24, 2006 at 08:35 UTC

    The absence of a stupid typo! Sorry, the regex should have been $original_text=~ s/(?<=\d)mp\b//g;.

    By the way I strongly recommend that you add use strict; use warnings; to any script you write. You then need to declare variables using my, but many problems get found before they bite hard.

    You should also browse the following documentation, probably in the order given: perlretut, perlre and perlreref.


    DWIM is Perl's answer to Gödel
Re^3: REGEX Help
by rsriram (Hermit) on Jun 26, 2006 at 07:08 UTC

    Hi, Your regex $original_text=~ s/(><=\d)mp\b//g; is not complete. You do have have a replacement string. Try this instead. $original_text=~ s/(.+)mp/$1/g;

    Sriram