Regular expressions extract structured data from text. Useful for log parsing.
Python regex basics:
import re
pattern = r'(\d{4}-\d{2}-\d{2}) (\w+): (.+)'
match = re.search(pattern, line)
if match:
date, level, message = match.groups()
Common patterns:
\d+: One or more digits\w+: Word characters\s+: Whitespace.*?: Non-greedy match(group): Capture group
IP address: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
Interview tip: Simple patterns that work beat complex patterns that might fail.