John
Thanks.
John

"CPT John W. Holmes" wrote:

> If you have "TI: text ¶ TI: text2 ¶" as a string, my first example (if ereg
> is greedy by nature) will match " text ¶ TI: text2 " as a single match. It
> will be greedy and try to match as much text as it can between any TI: and ¶
> character. The second example will match text, but only if it's not (hence
> the ^ within [ and ]) the ¶ character. So, with the second, you'll end up
> with two matches " text " and " text2 ".. which is what you want, right?
>
> As for docs, just search anywhere for "regular expressions" and you can
> learn the basics. The implementation of ereg_* vs. preg_* functions are a
> little different, but once you learn the regular expression basics, you'll
> be fine. The PHP docs for each set give some examples. phpbuilder.com also
> has a good article on them.
>
> ---John Holmes...
>
> ----- Original Message -----
> From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 17, 2003 2:54 PM
> Subject: Re: [PHP] copy ...
>
> > Captn John,
> > What the difference? I recognise the code from my attempts at Perl. What's
> the diff between ^ and *? Is there a doc I can read up more on?
> > ;) Swabbie John
> >
> > "Cpt John W. Holmes" wrote:
> >
> > > What about
> > >
> > > eregi("TI(.*)¶",$line,$m)
> > >
> > > might want to use
> > >
> > > eregi("TI([^¶]*)¶",$line,$m)
> > >
> > > so it's not greedy.
> > >
> > > ---John Holmes...
> > >
> > > ----- Original Message -----
> > > From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Monday, March 17, 2003 2:31 PM
> > > Subject: Re: [PHP] copy ...
> > >
> > > > Perl, I will never touch again :) Find occurence of "TI:" and "¶" in
> the
> > > string $textarea and extract it only. The problem is the user may have
> > > entered \r\n. Therefore making \n out of the question to use as my end
> > > marker.
> > > >
> > > > John
> > > >
> > > > Marek Kilimajer wrote:
> > > >
> > > > > I have a strong feeling that POSIX regexs cannot do multiline, try
> using
> > > > > perl-compatible, or make a loop to read the textarea content line by
> > > line
> > > > >
> > > > > John Taylor-Johnston wrote:
> > > > >
> > > > > >I need to process the contents of <textarea name="textarea">
> > > > > >
> > > > > ><textarea name="textarea">SU: something ... blah blah¶
> > > > > >TI: Title ... asasa asasas asas¶
> > > > > >AU: author field ... asasasas¶
> > > > > ></textarea>
> > > > > >
> > > > > >I want to filter $textarea. I need to change my code below to grab
> > > everything between "TI:" and "¶", but not including "¶" :
> > > > > >
> > > > > >I have this code.
> > > > > >
> > > > > >--------snip------------
> > > > > >
> > > > > >filter_strings("TI: ", $textarea)
> > > > > >
> > > > > >function filter_strings($tofilter,$line){
> > > > > >    if(eregi('^'.$tofilter.' (.*)$',$line,$m)) {
> > > > > >        $filtered=$m[1];
> > > > > >        return $filtered;
> > > > > >     }
> > > > > >}
> > > > > >John Taylor-Johnston
> > > > > >Université de Sherbrooke:
> > > > > >http://compcanlit.ca/
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to