How do I combine a word starting with "I" but not the word "Integer"?

How to write a regex that matches all words starting with I , except for the word Integer ?

Example:

  t1: Integer; t2: Interface; t3: IXml; 

The result should be Interface and IXml .

+4
source share
3 answers

This should do:

 I(?!nteger\b)\w+ 
+4
source

If you cannot use the predictive statement suggested by SilentGhost, you can express the same thing using the basic regular expression syntax:

 I(\b|[A-Za-mo-z][A-Za-z]*|n(\b|[A-Za-su-z][A-Za-z]*|t(\b|[A-Za-df-z][A-Za-z]*|e(\b|[A-Za-fh-z][A-Za-z]*|g(\b|[A-Za-df-z][A-Za-z]*|e(\b|[A-Za-qs-z][A-Za-z]*|r[A-Za-z]+)))))) 
+1
source

How about this:

 I(?!nteger).* 
0
source

Source: https://habr.com/ru/post/1316431/


All Articles