title: RegEx with LINQ to SQL queries to filter data to show on the UI
body: <p>Working with a database TABLE called Costcenter. 
  I am trying to show the Costcenters in a dropdownlist where CostcenrCode is only three numeric characters. I was trying to do that on the VIEW on an ASP.Net WF application. Now I have moved it to the DataAccess query where I am using LINQ to SQL. I am bit confused, how to do it in the LINQ query where I am returning String. I am selecting cc at the end which is populating all the Costcenters in the database table. But I need to only pull the one is like (e.g. 100 instead of F.C56). </p>
  
  <p>My DataAccess code is as follows: </p>
  
  <pre><code>    public static IEnumerable&lt;Costcenter&gt; GetAllCostcentersByCountryCompanyProfitcenterYear(short year, int companyID)
      {
          List&lt;Costcenter&gt; costcenters = new List&lt;Costcenter&gt;();
          using (var context = new CostReportEntities())
          {
              costcenters = (from cc in context.Costcenters
                             join company in context.Companies on cc.CompanyID equals company.CompanyID
                             where cc.Year == year &amp;&amp; cc.CompanyID == companyID
                             select cc).ToList();
  
          }
          return costcenters;
  
      }
  </code></pre>
  
  <p>I have been looking at few posts here, but couldn't put anything together since I am new in LINQ to SQL.  </p>