Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21246

Regular Expression - Exclude

$
0
0
I am reading one line in at a from a text file, using FileSystemObject.

In order for this to be a true condition, there will be a word to be matched and a group of words not to be matched.

I am not sure where to start with the pattern:

Include to be matched word: America
Exclude to be matched words: Jack|and|Jill

I got this to work:
"This is the America!"
"^(\w*|\s*)*(America)(\w*|\s*)*\!?$")

The above should return True.

"This is the America! Jack and Jill lives here."

The above should return False.

I basically know how to find a whole word but don't know how to exclude a whole word. If my logic is not correct, please feel free to correct and enlighten.

Viewing all articles
Browse latest Browse all 21246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>