Regex Golf

Where the art of pattern matching meets the sport of minimizing.

import re

# The goal is to match the longest possible string

s = 'hello world'

# The regex pattern

pattern = '.*?'

# The match

match = re.search(pattern, s).groups()

# The length of the match

len(match)