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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.