I have N keywords, key1 key2 ... keyN. 
I have 3 pattern to match the keywords. (To make the problem simple I just use key1 instead of real keyword)
/keyword {keyword} (keyword)
I decide to find the match pattern by simply using regex:
The pattern I wrote:
(?:/)(key1|key2|key3)|(?:{)(key1|key2|key3)(?:})|(?:\()(key1|key2|key3)(?:\))
But for the keyword(key1|key2|key3), I need to write 3 times, also I got 3 groups (should be reduce to 1 for the best result).
How can I achieve this in Java or the standard regular expression ?