in reply to matching substring in url

How about m{/(\w+)(?:$|;arg=)}? (WebPerl Regex Tester)

However, obviously there may be cases where the regex might not work. As you've only given two examples, that's not really enough to confirm. Please see Re: How to ask better questions using Test::More and sample data for how to write more test cases for regexen. Or, you might want to look into using a proper parser such as URI (Update: choroba just posted an example).

Replies are listed 'Best First'.
Re^2: matching substring in url
by cioperl (Novice) on Nov 08, 2019 at 19:39 UTC
    thanks guys!