String find and get string + round it?!

Gertie

Freshman
Joined
May 8, 2003
Messages
25
Location
Belgium
Hello,

I'd like to search for a word in a string. And whenever i get an occurence it takes the word + X-words around it!!
Let me explain with an example.

if i have a string: "Hello, my name is Gertjan the ASP Guy from Belgium let me thank you al for helping me!"

Then if i search on this string for "an" and is set X=3 then it wil give me the words with "an" in it and 3 words before and 3 words after that word. With "..." in between.

The result would be: "... my name is Gertjan the ASP Guy ... Belgium let me than you al for ..."

I can already get the AN in bold. so for the moment i already have in a second string: "Hello, my name is Gertjan the ASP Guy from Belgium let me thank you al for helping me!"

I've done this with Regular Expressions.

thx for the help, Gertie
 
Back
Top