I user golang func (*Regexp) Match
to check if a string matches some pattern.
matched = regexp.Match(mystr, []byte(pattern))
How can I write pattern to get matched=true
when passing mystr fulfilling the following requirements:
- contain at least one "/"
- not start with "alex/", "merry/", "david/"
so mystr="publicfile", "alex/personalfile", "merry/personalfile", "david/personalfile" will get rejected, which means matched=false.
How can I write one patter for this purpose? Thanks in advance.