Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've spent some time, but still have to solution. I need regular expression that is able to match a words with signs in it (like c++) in string.

I've used /word/, for "usual" words, it works OK. But as soon as I try /C++/ it just does not work. It some how works wrong with a plus signs in it.

I need a regex to detect if input string contains c++ word in it. Input like,

"c++ developer"
"using c++ language" 

etc.

ps. Using C#, .Net Regex.Match function.

Thanks for help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
468 views
Welcome To Ask or Share your Answers For Others

1 Answer

+ is a special character so you need to escape it

C++(?!w)

Note that we can't use because + is not a word-character.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...