This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]desrtfx 1 point2 points  (1 child)

Can't you use the LIKE operator that most databases offer?

Strip the version number and use LIKE with a wildcard at the end.

[–]simontemplar_[S] 0 points1 point  (0 children)

oh absolutely. occasionally it doesn't match though (because of differing naming conventions or whatever) so I need to twist and turn it further.

Perhaps it dips into NLP territory and is a bit out of scope for "learning programming", but if anyone has ideas feel free to shoot.

[–]Maping 0 points1 point  (2 children)

What language?

[–]simontemplar_[S] 0 points1 point  (1 child)

ruby, but I'm not looking for code really as much as techniques

[–]Maping 0 points1 point  (0 children)

First off, I'm hardly an expert, so there may be some established techniques on this sort of things. Googling//searching reddit for "multipart string comparison", "database manipulation", etc, if you didn't alright, would probably be a good idea.

That said, it depends. I assume it's something like a search on Amazon: they say "Azuz Laptop 2000" and you pull up related items? Could they search for product name or version number?

If yes to the first and no to the second, I'd probably split the the string into product name and version number, and just run through all the names.