title: Regex JavaScript If/Else statement
body: <p>I don't have previous experience working with regex and that's why I need your help. </p>
  
  <p>I have 3 different web services which I'm using to grab data via live search. Here is the logic of my statement which I'm trying to implement. </p>
  
  <pre><code>if(carName is entered) {
    getCarName.php?text=blablabla
  } elseif (carModel is entered) {
    getCarModel.php?text=blablabla
  } elseif (carNumer is entered) {
    getCarNumber.php?text=1337
  }
  </code></pre>
  
  <p>The idea is if <code>carName</code> is entered it could be a simple string like <code>Pontiac Firebird 2002</code>, then <code>carModel</code> can be <code>OHC inline-6 and a single-barrel carburetor</code>. carName and carModel may contain characters and numbers. <code>carNumber</code> can have numbers-only value like <code>194378</code>.</p>
  
  <p>I've started evaluation <a href="http://www.regexr.com/" rel="nofollow"><code>regexr.com</code></a> website, but still didn't came up with a possible solution to my problem.</p>
  
  <p>I want to have 1 input field (search field). I have different 3 web services. I have a working live search for 1 web service (carName). It's working fine, but I want to make a regex statement to find out when in the input search field is entered carName or carModel or even carNumber. How I can do it?</p>
  
  <p>As an example, here is a code snippet for my live search for carName web service:</p>
  
  <pre><code>$('#search').keyup(function() {
          var searchField = $('#search').val();
          var $update = $('#update');
  
          $.get("getCarName.php?text=" + searchField, function(data) {
            $update.empty();
            var vals = jQuery.parseJSON(data);
  
              if($.isArray(vals['Car'])) {
                $.each(vals['car'], function(k,v){
                  $update.append("&lt;li value='"+v['id']+"'&gt;&lt;a href='#'&gt;" + v['car_name'] + "&lt;/a&gt;&lt;/li&gt;");
                });
              } else { 
                  $update.append("&lt;li value='"+vals['car']['id']+"'&gt;&lt;a href='#'&gt;" + vals['car']['car_name'] + "&lt;/a&gt;&lt;/li&gt;");
              }
  
          });
        }); 
  </code></pre>
  
  <p>Based on a code above, I want to create an if/else statement to figure it what which web service it should use based on the input string.</p>
  
  <p>According to the regexr.com carName and carModel can be achieved from:</p>
  
  <pre><code>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
  </code></pre>
  
  <p>And carNumber from:</p>
  
  <pre><code>0123456789
  </code></pre>
  
  <p>Buy how I can create a If/Else condition according to this?</p>
  
  <p>Can please anyone help me with that?</p>