I am writing a regex that I need to catch lines that are plural starting with "get". For example, getContacts and getBuildings must match a regular expression. However, there are times when the text can be equal to getDetails or get**Details . I do not want the regex to include them.
I can come up with a regular expression that includes the corresponding Details group, but I want to exclude this capture group, and not include it.
[Gg]et?\w+([Dd]etail)s
I am not very strong at regex, but I understand my understanding of what I wrote:
a match of "g" or "G" followed by "et", and then optionally any character of the word, then the corresponding group, followed by "s".
How can I exclude results containing the word "details"?
source share