# Problem with accurate substring matching

**URL:** <https://forum.kirupa.com/t/problem-with-accurate-substring-matching/306375>\
**Category:** Uncategorized\
**Created:** [March 14, 2010, 11:42am UTC](https://forum.kirupa.com/t/problem-with-accurate-substring-matching/306375 "2010-03-14T11:42:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadaj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kadaj/32/9061_2.png) [@kadaj](https://forum.kirupa.com/u/kadaj)\
**Post date:** [March 14, 2010, 11:42am UTC](https://forum.kirupa.com/t/problem-with-accurate-substring-matching/306375/1 "2010-03-14T11:42:22Z")

</div>

Hi,  
How to match substrings accurately?  
eg: I wanted to search whether any pronouns like he, she etc are present in a string say input.  
Where is he?  
Here I wanted to find whether the pronoun ‘he’ is present. But since the w **he** re contains the substring ‘he’ I can’t get the result properly.

I tried with RegExp and arrays and strings; using match(), search() indexOf(). They all do it the same way.  
My RegExp pattern is as below:

```auto

var pronouns:RegExp = /(i)|(me)|(us)|(he)|(him)|(she)|(her)|(it)|(they)|(them)|(that)/;

```

I wanted to find for eg, strings like

He is alright  
Where is he  
She is there  
Who is it  
I know them

In the above sentences I wanted to get the position of where the pronouns ‘he’ ‘she’ ‘it’ ‘them’ etc occurs.  
Why because if it occurs I wanted it to replace them with another words.

Any ideas?  
Thanks
