package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^(.*/)?(?:$|(.+?)(?:(\.[^.]*$)|$))`)
s := `https://www.collectivesolver.com/question.html`
match := re.FindStringSubmatch(s)
fmt.Println(match[2])
s = `/home/public_html/files/abc.png`
match = re.FindStringSubmatch(s)
fmt.Println(match[2])
}
/*
run:
question
abc
*/