Article View: pl.comp.lang.perl
Article #52176Re: regexp i zmienna
From: Michal Jankowski
Date: Wed, 23 Feb 2011 18:49
Date: Wed, 23 Feb 2011 18:49
21 lines
1450 bytes
1450 bytes
Szymon Sokół <szymon@bastard.operator.from.hell.pl> writes: >> $` $& $' > $string =~ /(.*)(wzorek)(.*)/ > my($pierwsza,$druga,$trzecia) = split /(wzorek)/, $string; Spróbujcie: ------------------------------------------------------------ #!/usr/bin/perl -w $s = "Ala ma kota, a Ola ma psa"; $s =~ /ma/; print "($`) ($&) ($')\n"; $s =~ /(.*)(ma)(.*)/; print "($1) ($2) ($3)\n"; ($a,$b,$c) = split /(ma)/, $s; print "($a) ($b) ($c)\n"; ------------------------------------------------------------- Wesołego. MJ
Technical Details
Message-ID:
<kjzaahmio29.fsf@ccfs1.fuw.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!uw.edu.pl!not-for-mailReferences:
<ik1miv$t6o$1@node2.news.atman.pl> <5qjf38-hb7.ln1@depesz.com> <19qawculecjw2$.dlg@falcon.sloth.hell.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!uw.edu.pl!not-for-mail From: Michal Jankowski <michalj@fuw.edu.pl> Newsgroups: pl.comp.lang.perl Subject: Re: regexp i zmienna Date: Wed, 23 Feb 2011 19:49:18 +0100 Organization: Warsaw University, Physics Department Lines: 21 Message-ID: <kjzaahmio29.fsf@ccfs1.fuw.edu.pl> References: <ik1miv$t6o$1@node2.news.atman.pl> <5qjf38-hb7.ln1@depesz.com> <19qawculecjw2$.dlg@falcon.sloth.hell.pl> NNTP-Posting-Host: ccfs1.fuw.edu.pl Mime-Version: 1.0 X-Trace: h1.uw.edu.pl 1298486962 29546 193.0.81.21 (23 Feb 2011 18:49:22 GMT) X-Complaints-To: usenet@news.uw.edu.pl NNTP-Posting-Date: 23 Feb 2011 18:49:22 GMT User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (usg-unix-v) Cancel-Lock: sha1:glYRowRJ1rBnRN7OTkrpjwMhM94= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit