topical media & game development
basic-regex-23-DelimiterTest.php / php
<html>
<head>
<title>Using preg_match() with different delimiters.</title>
</head>
<body>
<?php
if (preg_match("/Hel/", "Hello world!")) echo "<p>A match was found using paired '/' as delimiter.</p>";
if (preg_match(".Hel.", "Hello world!")) echo "<p>A match was found using paired '.' as delimiter.</p>";
if (preg_match("{Hel}", "Hello world!")) echo "<p>A match was found using matched '{' and '}' as delimiters.</p>";
if (preg_match("(Hel)", "Hello world!")) echo "<p>A match was found using matched '(' and ')' as delimiters.</p>";
if (preg_match("<Hel>", "Hello world!")) echo "<p>A match was found using matched '<' and '>' as delimiters.</p>";
?>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.