in reply to Re^4: Extract delimited words from string
in thread Extract delimited words from string

Simple enough-the extract_multiple() function can apply multiple functions or regular expressions to do so. Changing the extract_multiple() line to the following:
@extracted = extract_multiple( $str, [ \&extract_quotelike, qr/\s+/, ], );
results in the following output:

Input: 50 0 "R0 G255 B0 A255" "Solid" 118 1 "R0 G0 B0 A255" "R0 G0 B0 + A255" 0 Output: 50 0 "R0 G255 B0 A255" "Solid" 118 1 "R0 G0 B0 A255" "R0 G0 B0 A255" 0 Input: 70 0 "R0 G255 B255 A255" "Solid" 118 1 "R12 G12 B12 A255" "R12 + G12 B12 A255" 0 Output: 70 0 "R0 G255 B255 A255" "Solid" 118 1 "R12 G12 B12 A255" "R12 G12 B12 A255" 0

(My original code was just extracting based on the quotation marks as delimiters.)

Hope that helps.

Replies are listed 'Best First'.
Re^6: Extract delimited words from string
by LanX (Saint) on Dec 09, 2022 at 02:24 UTC