Topic: About using match()

<html>
<head>
<title>JavaScript String match() Method</title>
</head>
<body>

<script type="text/javascript">

var str = "For more information, see Chapter 3.4.5.1";

var re = /(chapter \d+(\.\d)*)/i; <-----------------

var found = str.match( re );

document.write(found );

</script>

</body>
</html>

This returns the value Chapter 3.4.5.1,Chapter 3.4.5.1,.1

Just came across this code while studying the match() function..I was wondering whats the meaning of that code that I colored RED...

Last edited by jtified (2009-08-26 00:50:35)

Re: About using match()

That's a regular expression, used to look for a specific string of characters. You can get more info by doing a web search for "regular expression" or perhaps starting here: http://www.regular-expressions.info/

Re: About using match()

Thanks again! ^^