Click here to get back home

eregi

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
eregi Kill Joy 07-16-2008
|--> Re: eregi Juergen-Bernhar...07-16-2008
---> Re: eregi Juergen-Bernhar...07-16-2008
|   ---> Re: eregi Jerry Stuckle07-17-2008
Posted by Kill Joy on July 22, 2008, 1:01 pm
Please log in for more thread options
Hi all!

The file generated by the application is this

http://www.sexyshopboys.com/pr/project.js

and if I search on this I get nothing :(

But if I copy and paste into anothe file it works.
Here the copy n paste

http://www.sexyshopboys.com/pr/copy_n_paste.js

If I search on this it works :)
The second file has half the size of the first.


Any ideas?


many many thanks.



Gius from Italy :)





> > I have a file generated by an application. If I search on this file I
> > get nothing.
> > But if I copy and paste the content of this file into another file,
> > with the second file
> > it works. Why?
> >
> > Cheers.
> >
> > Gius.
> >
>
> Let's see... My crystal ball says it could be (in no particular order):
>
> File format
> File permissions
> File still open
> A bug in your code
> Something else
>
> But it can't tell which of the above might be the problem. It does,
> however, ask you not to top post.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


Posted by Curtis on July 18, 2008, 8:15 pm
Please log in for more thread options
Kill Joy wrote:
> Hi all.
>
> I have a file that stats with
> ___________________________________
> /* Vim-generated file */
> //Generated settings file for Vim project.
> ...
> .......
> ___________________________________
>
> I open it with:
>
> ___________________________________
> $log = file("project_vim.js");
>
> foreach($log as $value){
>         if(eregi("vim", $value)) {
>                 echo $value."";
>         }
> }
> ___________________________________
>
>
> But I match nothing
>
> Why?
>
> Many thanks.
>
> Cheers.
>
> Gius.

First, off, when using regex, don't use POSIX (ereg*), they're slower
and less powerful than PCRE.

Also, from the looks of your code, you don't even need regex:

if ( strstr($value, 'vim') )
echo $value;

If the substring 'vim' exists within $value, the strstr returns true.
It's also case sensitive. If you can ignore case by using stristr,
instead.

Have a look through the String Functions portion of the PHP manual:
<URL:http://php.net/manual/en/ref.strings.php>

Curtis (http://dyersweb.com/)

Similar ThreadsPosted
eregi and eregi replace January 10, 2006, 11:50 pm
eregi help? September 17, 2005, 9:04 pm
eregi June 2, 2007, 5:58 am
eregi() question August 18, 2005, 12:11 am
eregi whitespace detection problem October 30, 2004, 4:53 pm
Help with email address validation using eregi() December 2, 2004, 3:19 am
simple eregi not working (PEBCAK) December 4, 2004, 7:19 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap