I have to extract a function name from various c++ function calls. Following are some of the function calls examples and extracted function names highlighted.
std::basic_fstream<char,std::char_traits<char> >::~basic_fstream<char,std::char_traits<char> >
~basic_fstreamCSocket::Send
sendCMap<unsigned int,unsigned int &,tagLAUNCHOBJECT,tagLAUNCHOBJECT &>::RemoveAll Cerner::Foundations::String::Rep::~Rep
~RepCCMessage::~CCMessage
~CCMessagestd::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,u
_TreeLib::DispatcherCache::~DispatcherCache
~DispatcherCacheCPrefDataObjectLoader<CPrefManagerKey,CPrefManagerValue,CGetPrefManager,PrefManagerKeyFunctor>::Get
GetThe following Regex works for most of the functions
/((?:[^:]*))$';/
This regex get the string from the last :/+?(?=<)';/
This one removes string that starts with <
But for std::basic_fstream<char,std::char_traits<char> >::~basic_fstream<char,std::char_traits<char> >
the output I get is char_traits
because this string is after last ':' but the result should be ~basic_fstream
. Is there a way I can combine both regex and ignore everything that is within <>
?