Regular Expression for getting everything after last slash

regex

Solution

No, an `^` inside `[]` means negation.

`[/]` stands for 'any character in set [/]'.

`[^/]` stands for 'any character not in set [/]'.

Problem

I was browsing stackoverflow and have noticed a regular expression for matching everything after last slash is ``` ([^/]+$) ``` So for example if you have http://www.blah.com/blah/test The reg expression will extract 'test' without single quotes. My question is why does it do it? Doesn't ^/ mean beginning of a slash? EDIT: I guess I do not understand how +$ grabs "test". + repeats the previous item once or more so it ignores all data between all the / slashes. how does then $ extract the test

Original source

Related problems