regular expression to match exactly two words and not one of the the two
I am wondering , how would i match the words "SAN JOSE" in a string "I love SAN JOSE but JOSE does not like it " so in essence i do not want the the word Jose to be matched but S开发者_如何学JAVAAN JOSE should be matched together.
any ideas . thanks
You don't need regular expressions in this case. You didn't specify a language, but most of them support basic string matching. Just search for 'san jose'
in case-insensitive mode.
You need a look-ahead assertion:
/san (?=jose)/
You need to escape the space:
/SAN\ JOSE/
精彩评论