ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Mikhail Zabaluev <mhz@alt-linux.org>
To: mandrake-russian@altlinux.ru
Subject: [mdk-re] Re: [mdk-re] офтопик - регулярные выражения
Date: Sun May 27 21:59:00 2001
Message-ID: <20010527221617.C1501@localhost.localdomain> (raw)
In-Reply-To: <3B1116CA.1C3C695E@altlinux.ru>; from rider@altlinux.ru on Sun, May 27, 2001 at 07:01:30PM +0400

Hello Anton,

On Sun, May 27, 2001 at 07:01:30PM +0400, Anton Farygin wrote:
>
> Sergey Degtyaryov wrote:
> 
> > Доброго времени суток, Anton,
> >
> > 25.05.2001 в 16:14 Вы сказали буквально следующее:
> >
> > >>>Нет, нет, я про модификаторы сзади. В приведенном примере нужно
> > >>>добавить 's' позади pattern'а, чтобы '.*?' захватывали символы перевода строки.
> >
> > AF> А как быть в случае, если искать нужно вот в такой строке:
> >
> > AF> <li><font size=+1><a
> > AF> href=
> > AF> "Линк
> > AF> "
> > AF>  >Название</a>Дата</font></li>
> >
> > А что - s не помогает?
> >
> > #!/usr/bin/perl
> > $_ = '<a
> > href=
> > l
> > i
> > n
> > k
> > >
> > t
> > i
> > t
> > l
> > e
> > </a>
> > d
> > a
> > t
> > e
> > </font>
> > </li>';
> >
> > @results = /href=(.*?)>(.*?)<\/a>(.*?)<\/font>/s;   # вот тут
> > foreach (@results) {s/\n//g}
> > print join "\n", @results;
> > exit;
> >
> > link
> > title
> > date
> 
> Не совсем такая задача - смысл все делать в одном регулярном выражении.
> Вот например :
> cat man_test.html |perl -p -e 's/(<)(.*?)(\n)/\1\2/gs''
> Убирает первый перевод строки. А вот как убрать все последующие?
> Убрать их вообще во всех тегах. Т.е. между "<" и ">"

perl -p -e "s[(<.*?>)]{ join(' ', split(/\n/, $1)) }gse"

Подойдет?

> Запускать это выражения я буду в PHP. Соответсвенно перловые конструкции не катят :-(

Катят перловые регулярные выражения, см. документацию по pcre.

-- 
Stay tuned,
  MhZ                                     JID: mookid@jabber.org
___________
Wilner's Observation:
	All conversations with a potato should be conducted in private.



  reply	other threads:[~2001-05-27 21:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-16 18:06 cornet
2001-05-16 21:14 ` [mdk-re] офтопик -регулярныевыражения Sergei
2001-05-17 13:37   ` Vyt
2001-05-17 14:38     ` [mdk-re] " cornet
2001-05-19  2:55 ` [mdk-re] Re: [mdk-re] офтопик - регулярные выражения Mikhail Zabaluev
2001-05-19  4:28   ` Sergey Degtyaryov
2001-05-19 13:09     ` Mikhail Zabaluev
2001-05-21 14:04       ` cornet
2001-05-25 16:08         ` Anton Farygin
2001-05-25 16:50           ` [mdk-re] Re[2]: " Sergey Degtyaryov
2001-05-25 17:03             ` [mdk-re] " Alexander Bokovoy
2001-05-28 13:01               ` [mdk-re] помогите настроить RELAY в POSTFIX Serg
2001-05-28 13:07                 ` Volkov Serge
2001-05-28 23:11                   ` Sergey Vlasov
2001-05-27 18:54             ` [mdk-re] Re[2]: [mdk-re] Re: [mdk-re] офтопик - регул ярные выражения Anton Farygin
2001-05-27 21:59               ` Mikhail Zabaluev [this message]
2001-05-28  8:23                 ` [mdk-re] Re: [mdk-re] офтопик - регулярные выражения Anton Farygin
2001-05-28 12:18                   ` Mikhail Zabaluev
2001-05-28 12:56                     ` Anton Farygin
2001-05-28 13:50                       ` Баталов Григорий
2001-06-01 10:43               ` [mdk-re] Re: ÏÆÔÏÐÉË - ÒÅÇÕÌÑÒÎÙÅ ×ÙÒÁÖÅÎÉÑ Andrey Brindeew
2001-06-01 10:59                 ` [mdk-re] Re: офтопик - регулярные выражения Anton Farygin
2001-06-01 11:18                   ` [mdk-re] " Mikhail Zabaluev
2001-06-01 11:33                     ` Anton Farygin
2001-06-01 14:53                   ` [mdk-re] Re: ÏÆÔÏÐÉË - ÒÅÇÕÌÑÒÎÙÅ ×ÙÒÁÖÅÎÉÑ Andrey Brindeew
2001-06-02 15:04                     ` [mdk-re] Re: [mdk-re] Re: офтопик - регулярные выражения Mikhail Zabaluev
2001-05-26  8:31           ` [mdk-re] " Maxim Savrilov
2001-05-26 18:10             ` Anton Farygin
2001-05-31 15:50           ` [mdk-re] " cornet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010527221617.C1501@localhost.localdomain \
    --to=mhz@alt-linux.org \
    --cc=mandrake-russian@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git