#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    456
    Rep Power
    15

    Preg_match unknown modifier


    Getting a PHP warning and non-performing regex with this code:

    Code:
    $subject = "<p>COLUMBIA, Mo. (AP) -- A few years ago";
    $pattern = "/<p>(.*)\(AP\)/";
    preg_match($subject, $pattern, $location);
    print_r($location);
    My goal is to have: $location[1] = COLUMBIA, Mo.

    When I test just the regex in a regex tester it runs fine. When I run this code in PHP I get a warning and the array has no values:
    PHP Warning: Unknown modifier '<' in /var/www/vhosts/allgamesfree.com/httpdocs/fanbash/mapdata.php on line 40

    Any help? Thanks!
  2. #2
  3. Jealous Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,303
    Rep Power
    9400
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    456
    Rep Power
    15
    Originally Posted by requinix
    What a stupid rule!

    And I was so proud of myself for figuring out the regex on my own.

    Thanks requinix!

IMN logo majestic logo threadwatch logo seochat tools logo