# Performing finds on the first two characters on any entry

**URL:** <https://www.ruby-forum.com/t/performing-finds-on-the-first-two-characters-on-any-entry/107726>\
**Category:** Rails\
**Created:** [June 25, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/performing-finds-on-the-first-two-characters-on-any-entry/107726 "2007-06-25T20:10:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![revanche](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@revanche](https://www.ruby-forum.com/u/revanche)\
**Post date:** [June 25, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/performing-finds-on-the-first-two-characters-on-any-entry/107726/1 "2007-06-25T20:10:13Z")

</div>

I have a basic find request where I am retrieving any records that match  
the first and last name provided in an earlier form. It’s almost like a  
directory lookup.

@master = Master.find(params[:id], :conditions =\> {  
:firstname =\> @contact.firstname,  
:lastname =\> @contact.lastname})

What I can’t figure out, however, is how to perform the find to handle  
name variations. For instance, Mike vs. Michael or Kate vs. Katie.

While it’s not perfect, I’d like to get closer to the result by having  
the find pull all records that have an identical last name and begin  
with the first two characters of the first name provided. I tried a few  
variations, but I’m getting hung up on how to find something that is not  
an exact match.

Any suggestions would be appreciated!
