The researchers tested the memory of planarians by measuring how long it took for them to reach food in a controlled setting. The small worms dislike open spaces and bright lights — but they had been trained to ignore it so that they could find their meals. Even after decapitation, worms that had gone through training were able to overcome their fears and start eating much faster than worms that hadn't been trained. However, the memories didn't come back immediately. Each worm still had to be reminded of its earlier knowledge, though it only took a single lesson for it to all come back.
Why this happens is still unclear. Planarians' brains control their behavior, but the researchers suggest that some of their memories might be stored elsewhere in their body. Alternatively, they suggest that the worms' original brain may have modified their nervous systems, and their nervous systems may have then altered how the new brains formed during regrowth.