title: Text parsing looking for data with different strings expressing the base units (ex. square meters, sq.m, m^2, m2, etc.)
body: <p>I'm trying to scrape the area number (square meters or square feet) of many residential properties which is stored in various txt files.</p>
  
  <p>The area is almost always expressed by specifying the units, either in the metric system (length expressed with metre as base unit) or in the UK Imperial System (length expressed with foot as base unit) by giving a number followed by the units.</p>
  
  <p>The area units have various string representations, for example "square meters" can appear as "sqm", "sq.m", "sq m", "square m", "sq.meters", "m^2", "m2", etc. (the capitalization of the different letters can also change).</p>
  
  <p>Some Examples of the TXTs I have (I've copied only the line with the data I'm interested into, cleaning the rest):</p>
  
  <p>1) </p>
  
  <pre><code>...
  Approximate Gross Internal Area = 40.1 sq m / 432 sq ft Re’
  ...
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>...
  Total area: approx. 37.3 sq. metres (402.0 sq. feet)
  ...
  </code></pre>
  
  <p>3)</p>
  
  <pre><code>...
  Approx. Gross Internal Area *
  413Ft’-38.37M’
  ...
  </code></pre>
  
  <p>My goal is to parse each txt file, get the square metres (or square feet) number and store it.</p>
  
  <p>I've started to look into Python Regular Expressions/RegEx, Pattern Matching, Text Processing and Text Parsing tools but I've decided to put the research on hold and see if anybody else ever had a similar goal.</p>
  
  <p>What do you think is the most efficient way of solving this specific task? By using RegEx, Text Parsing or what?</p>
  
  <p>I'm quite open to use other scripting languages (PERL, Ruby, etc.) if they're more suitable for this.</p>