Regex question

  • Thread starter Thread starter siddharthkhare
  • Start date Start date
S

siddharthkhare

Hi All,
I want to capture a pattrens..using regular expresion in c#
let say in following sentence

This is a boy.

I want to capture "boy" only if it is with in 10 character form index
where "is" started.

so lets say "is" started at index 7 ,I want to capture boy only if
starts at index 17 or less.

So two conditions "boy" has to be prefixed with "is" somewhere in the
sentence and must be with in 10 charaters apart from "is" .

Is it possible to do this in one regural expression?
Thanks
KS
 
This is a boy.

I want to capture "boy" only if it is with in 10 character form index
where "is" started.

is.{1,8}(boy)

You may want to use the RegexOptions.Singleline option.
 
Back
Top