how to match regular expression from right to left

From: Liang (leo2002chen_at_hotmail.com)
Date: 08/26/04

  • Next message: Gunnar Hjalmarsson: "Re: how to match regular expression from right to left"
    Date: Thu, 26 Aug 2004 17:32:00 +0800
    
    

    hi, I'm a newbie to perl :-p

    I want to parse this kind of string:
    /main/abcd/efgh/hhh/3

    to get the rightmost string that is enclosed in '/'. In this case, it's
    'hhh'.

    So, how to do this in Perl? something as '=~ /\/(.*)\//' ?

    or use index()?

    Thanks in advance,
    Liang


  • Next message: Gunnar Hjalmarsson: "Re: how to match regular expression from right to left"