Answers.Body: <p>The Contact API is non-standard in APIv3; a major goal of APIv4 is to remove these quirks.  The behavior you're seeing on Display Name is non-standard.  It also seems that a lot of the other operators (e.g. "LIKE") don't work on Display Name.</p>
  
  <p>If you can, you can search on First Name and/or Last Name, neither of which display the problem described here.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T14:28:51.763Z
Answers.Text: This explains a lot. I'll have to use a custom field which will mirror display name. Thanks!
Answers.UserDisplayName: Marko
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-23T14:05:36.850Z
Answers.LastActivityDate: 2018-01-23T14:05:36.850Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>How do I perform Contact GET for the contact with the exact display name which will return only contacts with that exact display name?</p>
  
  <p>Say I create two users xyz and xyzA</p>
  
  <pre><code>$result = civicrm_api3('Contact', 'create', array(
    'sequential' =&gt; 1,
    'contact_type' =&gt; "Individual",
    'display_name' =&gt; "xyz",
  ));
  
  $result = civicrm_api3('Contact', 'create', array(
    'sequential' =&gt; 1,
    'contact_type' =&gt; "Individual",
    'display_name' =&gt; "xyzA",
  ));
  </code></pre>
  
  <p>The flowing get request always returns both contacts (xyz and xyzA)</p>
  
  <pre><code>$result = civicrm_api3('Contact', 'get', array(
    'sequential' =&gt; 1,
    'display_name' =&gt; "xyz",
  ));
  </code></pre>
  
  <p>I want my API call to return only users with a display name xyz.
  How would I do this? </p>
  
  <p>There is an option to turn off Automatic Wildcard, but that would affect the entire website and all the users. Is there a way around this?</p>
  
Tags: <contacts><api><search><civicrm-home><core>
Title: How do I search for the exact string match using CiviCRM API
ThreadText: # How do I search for the exact string match using CiviCRM API
  
  (Asked by: username_0 on 2018-01-23)
  
  How do I perform Contact GET for the contact with the exact display name which will return only contacts with that exact display name?
  Say I create two users xyz and xyzA
  $result = civicrm_api3('Contact', 'create', array(
    'sequential' => 1,
    'contact_type' => "Individual",
    'display_name' => "xyz",
  ));
  
  $result = civicrm_api3('Contact', 'create', array(
    'sequential' => 1,
    'contact_type' => "Individual",
    'display_name' => "xyzA",
  ));
  
  The flowing get request always returns both contacts (xyz and xyzA)
  $result = civicrm_api3('Contact', 'get', array(
    'sequential' => 1,
    'display_name' => "xyz",
  ));
  
  I want my API call to return only users with a display name xyz.
  How would I do this? 
  There is an option to turn off Automatic Wildcard, but that would affect the entire website and all the users. Is there a way around this?
  
  **Tags:** contacts, api, search, civicrm-home, core
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-23. Score: 3 | Accepted answer
  
  The Contact API is non-standard in APIv3; a major goal of APIv4 is to remove these quirks. The behavior you're seeing on Display Name is non-standard. It also seems that a lot of the other operators (e.g. "LIKE") don't work on Display Name.
  
  If you can, you can search on First Name and/or Last Name, neither of which display the problem described here.
  
  > **Comments:**
  > **username_0**: This explains a lot. I'll have to use a custom field which will mirror display name. Thanks!  
  
  ---
  
  