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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.