# parses text like: # name = japhy age = "22" lang = 'Perl' # into a hash... but it retains those pesky quotes :/ my %data = $text =~ m{ ([^=\s]+) \s* = \s* ( ' [^']* ' | " [^"]* " | \S+ ) }xg; #### # 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* (?: ' (?2= [^']* ) ' | " (?2= [^"]* ) " | ( \S+ ) ) }xg; #### # 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;