title: Using regex library to create lexical analyzer in C++?
body: <p>I am trying to write an XML scanner in C++. I would ideally like to use the regex library as it would be much easier.</p>
  
  <p>However, I'm a little stumped as to how to do it. So, first I need to create the regular expressions for each token in the language. I could use a map to store pairs of these regexes in addition to the name of the token.</p>
  
  <p>Next, I would open an input file and want to use an iterator to iterate through the strings in my file and match them to a regex. However, in XML, you don't have spacing to separate strings.</p>
  
  <p>So my question is will this method even work? Also, how exactly will the regex library fit my needs? Is regex_match enough to fit my needs in a foolproof way so that my scanner isn't tricked? </p>
  
  <p>I'm just trying to create a skeleton of the process in my head so that I can start working on this. I wanted some input from others to see if I'm thinking about the problem correctly.</p>
  
  <p>I'd appreciate any thoughts on this. Thanks so much!</p>