Reputation: 2035
Here's my data:
public System.Collections.Generic.List<MyItem> MyItemGroupList() {
return base.Channel.MyItemGroupList();
}
public System.Threading.Tasks.Task<MyItem> MyItemGroupListAsync(){
return base.Channel.MyItemGroupListAsync();
}
public OtherItem OtherItemByParam(string param) {
return base.Channel.OtherItemByParam(param);
}
Here's my regex:
/(?<=return base\.Channel\.)(.*?)(?=\(.*\);)/g
MATCH 1
1. [102-117] `MyItemGroupList`
MATCH 2
1. [242-262] `MyItemGroupListAsync`
MATCH 3
1. [370-386] `OtherItemByParam`
But I don't want to match any function with Async in the name. I just can't get it to work.
I've tried inserting (?!Async)
but just can't get it.
Upvotes: 0
Views: 151
Reputation: 174696
You need to use negative lookahead assertion.
(?<=\breturn base\.Channel\.)(?![^()]*Async)\w+
(?![^()]*Async)
asserts that the string going to be matched won't contain the Async
until (
is reached.
Upvotes: 1