in reply to Re^6: A Beginner Needs Homework help
in thread A Beginner Needs Homework help

lol... I don't really think I need substitution...

:) sounds good

... That should ... the dash in front of it is undefined to me by my text book.. (elements of programming with perl)

What does it say a regular expression is composed of? What is the special characters like "?" called? So if its not the same kind of character as the special "?" character, its what kind of character?

:) Here is what rxrx says about the pattern

(The start of a capturing block ($1)
  \w+Match an identifier character, one-or-more times (as many as possible)
  (The start of a capturing block ($2)
    -?Match a literal '-' character, one-or-zero times (as many as possible)
    \d+Match a digit, one-or-more times (as many as possible)
  )+The end of $2 (matching one-or-more times (as many as possible))
)The end of $1

Its pretty close except it doesn't explain the literal space character ... it does show that in the next step

If you give rxrx a string, it will go a step further and show you how the regex matches

To do it run rxrx

then paste 'red:27  yellow:102  green:311  yellow:12  blue:45'

then paste /(\w+ (-?\d+ )+)/

then type m then enter and keep hitting space to see the next step

Here is what a step looks like

Trying literal whitespace ('\N{SPACE}') | V /(\w+ (-?\d+ )+)/ | V 'red:27 yellow:102 green:311 yellow:12 blue:45' [Visual of regex at 'rxrx' line 0] [step: 7]

So hopefully you can see what you're missing, its the thing you had in split