Need a regex for .h or .cpp
I need a regex for finding all .h, .c, and .cpp files in a folder. Help?
[no, this isn't homework, I just don't have time to开发者_开发知识库 learn regexes right now]
Try:
\.(h|c(pp)?)$
But do you really need a regex? Where are you using this?
Try this:
/\.h$|\.c$|\.cpp$/
You can also write it like this:
/\.(h|c|cpp)$/
精彩评论