in reply to Pattern Matching

G'day Sunil,

As already pointed out, your unformatted data is problematic; however, you may find that split is sufficient for your needs.

$ perl -le 'print +(split /\//)[-1] for ("/ba/mn/first one", "/ba/mn/s +econd")' first one second

-- Ken