Question: I would like to search any IP Addresses that would exist in the body of mails that is in my inbox on Lotus notes.
I am assuming some regular expression with wildcards should be used when searching.

Thanx in advance for any assistance.

Answer: 
Here is a plain JS solution that does what you want:

**HTML**

```
<div id="test">Chat</div>

```

**JavaScript:**

```
var wordselection = [
{ 'word': "Pomme", "gender": "m" },
{ "word": "Banane", "gender": "f"},
{ "word": "Ananas", "gender": "m" },
{ "word": "Chat", "gender": "f" },
{ "word": "Chien", "gender": "m" },
{ "word": "Poisson", "gender": "f" }

];   

var word = document.getElementById('test').innerHTML;

var item = wordselection.filter(function(el){
  return el.word == word
})[0];

console.log(item && item.gender);

```

It logs undefined if the word in the div is not from the list.

DEMO: <http://jsbin.com/AlOtINE/1/edit>

**EDIT:** If you need to check many such words, you can get better performance by storing them in a map (also known as Object in JavaScript):

```
var wordselection = {
  'Pomme' : 'm',
  'Banane' : 'f',
  'Ananas' : 'm',
  'Chat' : 'f',
  'Chien' : 'm',
  'Poisson' : 'f'
}

```

Then the filtering part is as simple as:

```
console.log(wordselection[word]); // gender or undefined

```

If you get the wordselection from an external source but still want to convert it to the above format you can use this snippet:

```
var optimizedwordselection;
for (var i=0; i<wordselection.length; i++) {
  optimizedwordselection[wordselection.word] = wordselection.gender;
}

```
You can just loop through your array of JSON objects:

```
var wordselection = [
  { 'word': "Pomme", "gender": "m", },
  { "word": "Banane", "gender": "f", },
  { "word": "Ananas", "gender": "m", },
  { "word": "Chat", "gender": "f", },
  { "word": "Chien", "gender": "m", },
  { "word": "Poisson", "gender": "f", },
]; 

var selectedWord = "Chien";
var selectedWordGender;
for(var i = 0; i < wordselection.length; i++) {
  if(wordselection[i].word === selectedWord)
  {
      selectedWordGender = wordselection[i].gender;
  }
}     

console.log(selectedWordGender);

```