Jump to content

[SOLVED] Eregi Problem


ionik

Recommended Posts

The problem im having is that the regex works but when i use it here it doesnt work correctly even though what im parsing is contained

if(!eregi('^\<\!---GROUP DEFINITION---\[([a-zA-z]+)\]---END DEFINITION---\>$', $this->file_contents))
{
}

 

Parsing

 

Fetching This --- >> <!---GROUP DEFINITION---[group]---END DEFINITION--->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{WEBSITE_NAME}</title>

 

Why isnt this work?

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/99847-solved-eregi-problem/
Share on other sites

well you aren't parsing the beginning so you don't need the ^ or the end so you don't need the $.

try something like (this is a guess):

<?php
if(!$eregi('/<!---GROUP DEFINITION---\[([a-zA-Z]+)\]---END DEFINITION--->/', $this->file_contents))
{
}
?>

 

http://devolio.com/blog/archives/30-Regular-Expressions-in-PHP.html

this is a good website to learn Regex with PHP

 

Just tested and it does work. ;)

 

Just a FYI you should click the Solved Topic button if you topic gets solved. I saw that you put solved in a post an another thread but you didn't click the button.

Link to comment
https://forums.phpfreaks.com/topic/99847-solved-eregi-problem/#findComment-510966
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.