title: Java Regular Expression contains search
body: <p>I am having application in Java where user will give file with filename in specific format. for eg: <strong>james-fcanada-csmith-l.txt</strong>, </p>
  
  <p>Where -f is indicator for firstName, -c is indicator of country and -l is an indicator of lastname.</p>
  
  <p>For this i created this RegEx <code>([\w\d\s].*)-f([\w\d\s].*)-c([\w\d\s].*)-l</code>, and it works fine.</p>
  
  <p>But if users changes the order of fields say <strong>smith-ljames-fcanada-c.txt</strong> <strong>(adds lastname first)</strong>, then this RegEx is not working..</p>
  
  <p>Please suggest how to achieve this kind of requirement using RegEx.</p>
  
  <p>Also, Let me know if there are other better ways to achieve this.</p>