What does this mean in javascript?

Hi, I need some help on this, I saw a piece of code of javascript and i was confused on this,can you help me please or enlighten my mind,what does this javascript mean or how this behave.Thank you in advance.

		this.className=this.className.replace(new RegExp(" over\\\\b"), "");

<!--[if lt IE 7]>
<script type="text/javascript">
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" over";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>
<![endif]-->



This code adds :hover functionality to IE6 and below (as IE6 only supports the :hover pseudo-class on anchor tags).
In the line you ask about, “this” refers to a <li> element of an unordered list with the id “nav”.
The script will apply a class of “over” to the <li> element in question when you mouse over it.
It will then remove the class as soon as you move your mouse away.

It means take the classname from “over” to empty. Meaning their would be no class for LI.

Hi, Thank you for the reply…what about this line

replace(new RegExp(" over\\b"), “”);

why he uses the RegExp? and what does this

over\\b
mean?

The \\b is a regular expression code for a word boundary in that position it will match any whitespace character or the end of the text.

Hi felgall,thank you for the reply and for explaining me. :slight_smile: