You can create a datagroup (also known as a class in the config files) and then use the findclass command (Click here) to search the class for the source IP and return the destination IP. You could then use the pool or node command to set the destination IP.
You can create a datagroup in the GUI under Local Traffic >> iRules >> Datagroup tab. You can check the wiki page or search for findclass to get some examples.