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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

regex help 1
Regular expression questions 4
HAVING clause 2
dynamically sorted list with duplicates 5
Advanced search and replace 2
Looking for a RegEx pattern 1
Help with Regex 1
escaping double quotes in Regex 3

Back
Top