I make a string pattern in c# is
(?:^|/|-(?!tg|tog))(w+-)?(tg|tog)(d+)(?:$|#|?)
where it work on as my expected
/path/name-tg1 : output: group[2]=tg, group[3]=1
/path/tog2 : output: group[2]=tog, group[3]=2
/tg3 : output: group[2]=tg, group[3]=3
/nametog2 : output: not match
right now I want to modify the pattern where expect
-tog4 : output: group[2]=tog, group[3]=4
/path#/tog4 : output: not match
/pa$th/tog4 : output: not match
/path./tog4 : output: not match
/p?ath/tog4 : output: not match
/#tg4 : output: not match
can I know how to modify the above regex pattern
1