RegExp's toLocaleString() and toString()
In this chapter you will learn:
Convert to string
toLocaleString()
and toString()
return the literal representation of the regular expression.
<!DOCTYPE html><!-- j a v a 2 s .co m-->
<html>
<head>
<script type="text/javascript">
var pattern = new RegExp("\\[oo\\]at", "gi");
document.writeln(pattern.toString()); // /\[oo\]at/gi
document.writeln(pattern.toLocaleString()); // /\[oo\]at/gi
</script>
</head>
<body>
</body>
</html>
The valueOf()
method for a
regular expression returns the regular expression itself.
Next chapter...
What you will learn in the next chapter:
Home » Javascript Tutorial » Regular Expressions