Article View: pl.comp.lang.javascript
Article #51181Re: [jQuery] Usuniecie wybranych elementow z tekstu
From: Gabriel Zastawnik
Date: Tue, 25 Sep 2012 12:50
Date: Tue, 25 Sep 2012 12:50
38 lines
1854 bytes
1854 bytes
Użytkownik "Tomasz Sowa" <ts@NOSPAM.ttmath.org> napisał w wiadomości
news:k3s8cv$v3f$1@news.dialog.net.pl...
> w przykładzie na początku masz jeszcze cyfry
A tak. Moj blad. Przepraszam. Mam cyfry, bo to dla klawiszy funkcyjnych.
> spróbuj tak:
>
> $(document).ready(function(){
>
> var myregex = /\[[a-z0-9]{1,3}\]/ig;
>
> $('table tr td').mouseover(function() {
> var newhtml = $(this).html().replace(myregex, '');
> $(this).html(newhtml);
> });
> });
Ostatecznie jest tak:
$('table tr td').mouseover(function() {
$(this).html(function(i,o)
{
return o.replace(/\[[a-z0-9]{1,15}\]/ig, '');
});
});
Czyli jak zwykle sie rozbilo o poprawny regexp.
Dziekuje bardzo!
--
--
Gabriel Zastawnik
http://www.sigsoft.pl
http://www.monitoringkomputera.pl
Technical Details
Message-ID:
<k3s9ka$uu$1@mx1.internetia.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mailReferences:
<k3s4g3$7gs$1@mx1.internetia.pl> <k3s8cv$v3f$1@news.dialog.net.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail From: "Gabriel Zastawnik" <zastawka@poczta.fm> Newsgroups: pl.comp.lang.javascript Subject: Re: [jQuery] Usuniecie wybranych elementow z tekstu Date: Tue, 25 Sep 2012 14:50:33 +0200 Organization: Netia S.A. Lines: 39 Message-ID: <k3s9ka$uu$1@mx1.internetia.pl> References: <k3s4g3$7gs$1@mx1.internetia.pl> <k3s8cv$v3f$1@news.dialog.net.pl> NNTP-Posting-Host: 77-254-156-126.adsl.inetia.pl Mime-Version: 1.0 X-Trace: mx1.internetia.pl 1348577738 990 77.254.156.126 (25 Sep 2012 12:55:38 GMT) X-Complaints-To: abuse@inetia.pl NNTP-Posting-Date: Tue, 25 Sep 2012 12:55:38 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Tech-Contact: usenet@internetia.pl X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-Priority: 3 X-Server-Info: http://www.internetia.pl/ X-MSMail-Priority: Normal Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit