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;
}

```
Here is what you want using JQuery:

JavaScript code:

```
 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", },

];  

     $.each( wordselection, function(key, value) {

         if ( value.word == $('#result').html() )
         {
             alert(value.gender);
         }
     })

```

<http://jsfiddle.net/GWUxc/>

Or using your random function:

```
 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", },

];  

function randomword(){
    var chosen = wordselection[Math.floor(Math.random()*wordselection.length)].word
document.getElementById("wordinput").innerHTML=chosen;
}

     randomword()
     $.each( wordselection, function(key, value) {

         if ( value.word == $('#wordinput').html() )
         {
             alert(value.gender);
         }
     })

```

<http://jsfiddle.net/GWUxc/1/>

Anyway, I like more the solution using `filter` approach: [Does array contain?](https://stackoverflow.com/questions/19266810/does-array-contain/19267042#19267092)