You have to learn the difference between a string and a variable when passing to a function or using in a script.
alert(url1(pages, ALT)); Vs alert(url1(pages, "ALT")); which the second one should not return anything if you have no delimiter that is ALT
Looking at this var pages = [ "|www.lboro.ac.uk|Loughborough University offers degree programmes and world class research.", "!www.xyz.ac.uk!An alternative University" , "%www%Yet another University"]; your delimiters appear to be | ! and %.
So your objective really is to
Look at each entry in the array, test for the passed string to see if it exists, that means you grab the first character at position 0 in the string. You could test the first character to see if it matches if you dont want to grab the first character.
You are if you have a match meant to return the description, not the address.
Is that correct?