There are two basic ways to drive a stepper motor, depending on if you can reverse the polarity on a coil or not. The reprap can and does, and this makes the "extra" wires on some stepper motors redundant. see [wikipedia] for more detailed information.
For our purposes, yes, unless it has five wires, it'll work fine.
So how do you determine which wire is which? Here's a process for you.
"pair" wires to determine coils
First, try turning the motor with your fingers, and notice how hard it is. Second, twist all the wires together, and notice that it's much harder to turn. This is how you'll determine the coils. third, pick a wire at random. This will be the first wire of pair one. fourth, pick another wire at random. Try twisting the motor. If it's just as easy to turn as it was in step one, it's the wrong wire, pick a different wire and try again. If it's the right wire, it'll be hard, but not as hard as it was in step two. fifth, mark these wires and go back to step three.
You'll now have the wires paired up into coil. If you have a four wire motor, you're done. If you have a six wire motor, two of the wires are going to be "dead" and not attached to anything. So go back to step four, and find the wire with the GREATEST resistance to turning. If there are two that are equal, you picked the "dead" wire in step three, and the two others are your coil.
If you have a 8 wire stepper, you'll need to determine which pairs of coils are the "same". There are four coils, each of which can be driven independently, but there are two "pairs" which are essentially the same. You want to hook these two pairs up in series so that you essentially have only two coils, each twice the length.
Good luck with that. (uhm... yeah, without getting too fancy, I can only say "try it". The stepper driver is current limited, so you won't burn up the motor, and if you guess wrong it won't work - big deal.)
Plug it into the stepper driver
The polarity of each coil doesn't matter, nor does which coil is which. So make sure each coil's wire is together on one side or the other of the plug, and plug it in.
It DOES actually matter which coil is which and what the polarity of the coils is, but if they're wrong the motor just turns the wrong way, which is easy to fix. Keep in mind the following:
1.Switching the polarity of either coil will reverse the stepper's direction. 2.Swapping coils will reverse the stepper's direction. 3.The stepper direction can be reversed in the firmware. 4.Plugging the plug in backwards swaps the coils, and reversed both coil A and coil B. Thus the net effect is to change the direction.
Simplest solution is to turn the plug around, unless you've compiled your own firmware and already know how to reverse the direction in firmware.