Please help with regular expression in javascript

Hi there,
I have written a regular expression to convert ‘&’ into ‘and’. however it only changes the first occurance of ‘&’ not all of them.

this is my first time using reg ex so I would love any help whatsoever

NB: this is a JavaScript Function


function tidyD(h){ 
    h = h.replace(/(\/?)&([^>]*)/gi, "$1and$2"); 
    return h;
}

eg:

[COLOR=DarkSlateBlue]apples & oranges & pears [/COLOR]
would become
[COLOR=DarkSlateBlue]apples and oranges & pears [/COLOR]
8-]

found the answer…

here it is

h = h.replace(/&/g, ‘and’);

this searches an entire string and converts all occurances of ‘&amp’ with ‘and’

any ideas on how to change the é character to e?

found the answer to that too

h = h.replace(/\u00E9/g, ‘e’);

\u00E9 stands for the unicode number.

his searches an entire string and converts all occurances of é to e

feel like im having a conversation with myself :pir: