Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Regular expression for html tag <p> ???

    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.

  • #2
    New Coder
    Join Date
    Apr 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #3
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    PHP Code:
    preg_match("/<p.*?>/"$text); 
    Check this out - http://weitz.de/regex-coach/

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Quote Originally Posted by Pennimus View Post
    Theif!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •