in reply to Re: Removing a text element from the middle of a string
in thread Removing a text element from the middle of a string

You went against your mantra of "down with .*" here... why not advocate using /(Version[^,]*),/ here?

Update
Oops, sorry Ovid. I saw it in his favorite nodes list, and thought it was his. Good rant from you. :)

$_="goto+F.print+chop;\n=yhpaj";F1:eval

Replies are listed 'Best First'.
(Ovid) RE(2): Removing a text element from the middle of a string
by Ovid (Cardinal) on Sep 30, 2000 at 09:11 UTC
    While I will confess that I noticed that merlyn has Death to Dot Star! listed (on his home node) as one of his favorite nodes, I'm actually the one who wrote that and I occassionally get friendly grief from fellow monks for using it. :)

    (Though if merlyn rants against .*, I'd be interested in seeing the link)

    Incidentally, I'd write the regex as follows (assuming that the data is very clean):

    my $result = $1 if $string =~ /,\s([^,]+)/;
    Cheers,
    Ovid

    Update: japhy, it's an easy mistake to make. I just feel proud to have made the list :)

    Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

RE: RE: Re: Removing a text element from the middle of a string
by runrig (Abbot) on Sep 30, 2000 at 21:51 UTC
    Or:
    /(Version.*?*),/
    Note - Depending on the data this may or may not perform worse than the previously suggested
    /(Version[^,]*,/