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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts

    preg_match() Help

    I'm getting a preg_match warning and I don't see where the problem is in my regex code:

    The warning:
    PHP Warning: preg_match() Unknown modifier ']' in /var/www/html/Fetch_Refresh_TFR_Data.php on line 596

    My php offending line:
    $php_TFR_description = "/detail_\d_\d{4}.html\">[A-Za-z0-9,' /].*/";
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What is the format you are trying to allow? Right now that last bracket is being escaped. Try this
    PHP Code:
    $php_TFR_description "/detail_\d_\d{4}.html\">[A-Za-z0-9].*/"
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by rfresh View Post
    I'm getting a preg_match warning and I don't see where the problem is in my regex code:

    The warning:
    PHP Warning: preg_match() Unknown modifier ']' in /var/www/html/Fetch_Refresh_TFR_Data.php on line 596

    My php offending line:
    $php_TFR_description = "/detail_\d_\d{4}.html\">[A-Za-z0-9,' /].*/";
    PHP Code:
    $php_TFR_description "/detail_\d_\d{4}\.html\">[^<]*/m"
    you also must:
    - escape dot before html
    - a better solution to fetch all until < is to use [^<]*
    - use m modifier for multiline

    best regards

  • Users who have thanked oesxyl for this post:

    rfresh (02-21-2008)


  •  

    Posting Permissions

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