You are here: Re: Regex help « PHP « IT news, forums, messages
Re: Regex help

Posted by Al on 06/07/05 02:35

RaTT wrote:
> Hi Guys,
>
> I am currently creating a once off text parser for a rather large
> document that i need to strip out bits of information on certain
> lines.
>
> The line looks something like :
>
>
> "Adress line here, postcode, country Tel: +27 112233665 Fax: 221145221
> Website: http://www.urlhere.com E-Mail: info@email.com TAGINCAPS: CAPS
> RESPONSE Tag2: blah"
>
>
> I need to retreive the text after each marker i.e Tel: Fax: E-Email:
> TAGINCAPS: ...
>
> I have the following regex /Tel:\s*(.[^A-z:]+)/ and
> /Fax:\s*(.[^A-z:]+)/ all these work as expected and stop just before
> the next Tag. However I run into hassels around the TAGINCAPS as the
> response after it is all in caps and i cant get the Regex to stop just
> before the next tag: which may be either all caps or lowercase.
>
> I cant seem to find the regex that will retreive all chartures just
> before a word with a : regalrdless of case.
>
> I have played around with the regex coach but still seem to be comming
> up short so i thought i would see if anybody can see anything i might
> have missed.
>
> any help most appreciated.
>
> Regards
> Jarratt

Add and "i" for case insensitive for all except the numbers type e.g.,

/TAGINCAPS:\s*(.[A-z:]+)/i

 

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

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