...

View Full Version : preg_match() Help



rfresh
02-21-2008, 06:20 AM
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,' /].*/";

_Aerospace_Eng_
02-21-2008, 06:40 AM
What is the format you are trying to allow? Right now that last bracket is being escaped. Try this

$php_TFR_description = "/detail_\d_\d{4}.html\">[A-Za-z0-9].*/";

oesxyl
02-21-2008, 03:55 PM
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_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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum