# parses text like: # name = japhy age = "22" lang = 'Perl' # into a hash... but doesn't capture the quotes! my %data = $text =~ m{ ([^=\s]+) \s* = \s* (?: (?*3= ['"] ) (?2= .*? ) \3 | ( \S+ ) ) }xg;