So, this is yet another string parsing question that has probably been asked before, but I am so far unable to find a solution.
I have a string that looks like the following:
"name1=value1 name2=' value2=0' name3=value3"
I need a loop that will break each pair into two scalars, $name and $value, and process them. The killer for me is the "name2=' value2'" pair. I need that leading space for value2 to be included into $value.
So far I am ending up with $name set to "name2" and $value set to "'" during one iteration of the loop, and $name set to "vlaue2" and $value set to "0'" during the next iteration. What I am expecting is $name set to "name2" and $value set to " value2=0" during one iteration.
I assume that a regular expression can be written for this, but my perlre is pretty thin right now. Any help will be greatly appreciated!
-Mark
In reply to parse string containing space by mtovey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |