...

View Full Version : Regular expression for html tag <p> ???



amirak17
08-20-2007, 04:10 PM
Can you please provide me with the PHP regular expression for the html tag for paragraph (using eregi() etc):

<p xxx xxx xxx>

moreover is it also possible to provide the PCRE version

thanks in advance.

amirak17
08-20-2007, 04:24 PM
Found it myself :-) (but PCRE version please???):

<?php

if ($_POST['submit'])
{
$mv_test = $_POST['test'];

if (eregi ("^<p.{0,}>$", $mv_test))
echo "Pattern matched";
else
echo "Pattern not matched";
}

?>

<form name="form1" action="test3.php" method="post">

<input type="text" name="test">
<input type="submit" name="submit">

</form>

Pennimus
08-20-2007, 05:38 PM
preg_match("/<p.*?>/", $text);


Check this out - http://weitz.de/regex-coach/

Inigoesdr
08-20-2007, 10:59 PM
Check this out - http://weitz.de/regex-coach/

Theif! :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum