A regular expression (regex) is a sequence of characters that defines a search pattern. Use it to match text and turn semi-structured descriptions into useful dataset features. section 7.1.2
For rental listings, patterns can capture an accommodation area, star rating, bedroom count, bed count, and bath count from one description field.
Python feature engineering
With pandas, apply str.extract() to create captured-value columns and use re.IGNORECASE when capitalization varies. Use str.contains() instead when a simple presence flag—such as studio, shared bath, or half-bath—is sufficient.


























