Jump to content

find words in file but not partial words


mapleleaf

Recommended Posts

  $file = file_get_contents("en-GB-oed-wlist.txt");
if(!strpos($file, $_GET['word'])) {
echo "Word not found!";
}else{
    echo $_GET['word'].' is ok';
}

 

I need to create a basic spell checker for UK English so color should not show up when Colorado is in the word list file which it will with the above code.

Any help much appreciated.

 

How can you remove color with that regex? This really isn't about the color right?

You misunderstood the question. mapleleaf was simply asking how to search a string of words for a certain word and did not want, for example, "Color" to match because "Colorado" was in the string.

I think my own question was confused as I really need to be able to run a function on a body of text not just a word. I was starting small  ;)

Any ideas for that most welcome and thanks for the help so far.

Here is the format of the file:

coloratura's

colorimeter

colorimeters

colorimeter's

colorimetric

colorimetry

colossal

colossally

Colosseum

colossi

colossus

colossus's

colostomies

colostomy

colostomy's

colostrum

colostrums

colostrum's

colour

colourant

colourants

colourant's

colouration

colourations

colouration's

colour-blind

colour-blindness

colour-blindness's

colour-code

 

 

It was too big to upload

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.