You are here: Simple question on string extraction « PHP Programming Language « IT news, forums, messages
Simple question on string extraction

Posted by Epetruk on 10/11/78 11:25

Hi,

I'm having to modify a PHP script even though I have little knowledge of PHP
itself. The script extracts specific strings from an html file, and I need
to it extract some further information.

Specifically, each file represents an article written by an author. The
author's name is typically preceded by a 'By' or a 'by', then it goes on
till there's a carriage return.

So for example, the file might contain something like this:


The Need For Regeneration

by <b>John Smith</b>

We have seen the waste that has been produced....

(rest of article)


or


How To Make Lots and Lots of Money Writing PHP

by The Supreme Coder

The first thing you need to know about making money is...

(rest of article)


So I need code that will start searching the file from the beginning for the
words 'by ' or 'By ', then grab everything that follows that until it gets
to a new line and assign that to a variable. In the examples I have given
above, it would grab '<b>John Smith</b>' and 'The Supreme Coder'. I've seen
a function called preg_match which might do the job, but it uses regular
expressions which I have little knowledge of.

Would any person be so kind as to post what arguments I would need to call
this function with?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация