473,473 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Compare array elements for a fairly close match

170 New Member
Does anyone know if it's possible to take an array element in one array and compare it with every array element in another array, given that the spelling might not be exactly the same and there might be an extra or a missing apostrophe etc.

Eg.

array1=("Jon the cat","Run for your life","Miss Marple's Great adventure")
array2=("John the cat","Running for your life","Miss Marples Great adventure")

I'm wondering whether if I took "Jon the cat" from array1 could I get a positive match from array2 even though the string's not exactly the same. Sort of a "like" function? Similar with Run and Running. And also with Marple's and Marples?
May 25 '08 #1
4 2090
Markus
6,050 Recognized Expert Expert
Check out similar_text()

Regards
May 25 '08 #2
hsriat
1,654 Recognized Expert Top Contributor
levenshtein()
soundex()
similar_text()
metaphone()

and of course
array_walk
May 25 '08 #3
beary
170 New Member
levenshtein()
soundex()
similar_text()
metaphone()

and of course
array_walk

ooh. Nice. I think metaphone should get the job done reasonably well. I've tested it on a few and it looks good. It should take care of apostrophes and misspellings. It won't work for extra words in a title, but I should be able to use substr or something like that.

Thanks again hsriat for such a quick and helpful reply. Cheers!
May 25 '08 #4
hsriat
1,654 Recognized Expert Top Contributor
You are welcome

May 25 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Phil Powell | last post by:
/*-------------------------------------------------------------------------------------------------------------------------------- Parameters: $formField1: The name of the first array $formField2:...
2
by: John Wilson | last post by:
Hello friends, I have this dynamic array(shown below) that I need to match to values (1 - 10) that I am returning from the database via DSN connection object. The values I need to match are on...
2
by: stealth_spoof | last post by:
Hi People wondering if anyone can help me with a problem I'm having I'm trying to create an array with an unspecified length, the length is based on the result i get from another task in the code...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
49
by: vfunc | last post by:
If I have a large array 10,000+ elements then how do I reserve memory for this ? Currently I get a segmentation fault. Dynamic reservation is good, but allowing a chunk for the program is an...
6
by: Justin Fancy | last post by:
Hi Everyone, I'm lookin for a very confusing loop (to me), to compare two files. Here it is. I have two arrays with paths stored in both. example: /en/aviation/you.htm. I need to search array...
3
by: Frank Rizzo | last post by:
I've had a windows service, that I've written and compiled with vs2003 and .net framework 1.1, running just fine on windows server 2003 for a long while. Recently the service was installed on...
7
stealwings
by: stealwings | last post by:
I have a little problem with my program, or maybe it is not that little, anyway here is the code: #include "stdafx.h" #include <iostream> using namespace std; #include <fstream> using...
11
by: doulos05 | last post by:
I am working on an xml project that will contain numerous documents which will be edited by about 100-150 non-technical people on a regular basis. Because of this, I am trying to make it as simple...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.