🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #39920

Re: newsgroup matching

#39920
From: Jan Hlavacek
Date: Sat, 04 Apr 1998 00:00
31 lines
1682 bytes
On 4 Apr 1998 14:47:34 GMT, lottifran <goo+!XXX!@ouverture.it> wrote:
> I'd like to match it.* newsgroups into my article_mode_hook function..
> Actually I use:
> 
>       is_substr (current_newsgroup (), "it.")
> 
> Using the previous method I run into problems because I don't only match
> it.* ng but also every group like *it.*

One possible solution is use strncmp,  which compares first n characters
of two strings.

    !if (strncmp (current_newsgroup (), "it.", 3)) do_something ();

> I don't know how to use regular expressions with slang.. maybe a simple
> ^it.* regex should be enough but I don't know how to make it suitable for
> slang..

    if (string_match (current_newsgroup (), "^it\.", 1)) do_something ();

For more information on slang functions and regular expressions,
visit http://www.math.ohio-state.edu/%7Elahvak/slang/ .

lahvak
-- 
Jan Hlav\'{a}\v{c}ek
lahvak@math.mps.ohio-state.edu  (Blind Carbon Copies will bounce)
www: http://www.math.ohio-state.edu/~lahvak/ 

Technical Details
Message-ID: <slrn6id581.noa.lahvak@math.mps.ohio-state.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <slrn6ici06.6ja.goo+!XXX!@artemide.section9.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6id581.noa.lahvak@math.mps.ohio-state.edu>
Subject: Re: newsgroup matching
Date: Sat, 04 Apr 1998 00:00:00 +0000
From: lahvak@math.mps.ohio-state.edu (Jan Hlavacek)
References: <slrn6ici06.6ja.goo+!XXX!@artemide.section9.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 340895656
Reply-To: lahvak@math.mps.ohio-state.edu
Organization: Department of Mathematics, The Ohio State University
Newsgroups: news.software.readers