🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
6 messages
6 total messages Started by Mike Mulvaney Mon, 09 Aug 1999 00:00
slrn: how do I match "["?
#50474
Author: Mike Mulvaney
Date: Mon, 09 Aug 1999 00:00
16 lines
973 bytes
I'm pretty used to regexps in perl and grep, but I am having a problem
in s-lang.  I am trying to match the character "[", and I can't get it
to work.  I tried \[, which gives me some error messages.

Here is the line:

   n = string_match(str, "/[", 1);

Slrn tells me there is an illegal parameter.  How can I do this?

Thanks,
Mike
mikemulvaney@excite.com


Re: slrn: how do I match "["?
#50481
Author: Dawn Owens-Nicholson
Date: Mon, 09 Aug 1999 00:00
16 lines
1144 bytes
Mike Mulvaney wrote:
> From: mike@asdf.asdf (Mike Mulvaney)

Why the fake e-mail address?  Your ISP should stop spam for you.

> \[ doesn't work for me, either.

In a string, you need to escape the backslashes:

  message ("This is a backslash: \\");

In a regex you can also use a 1-character character class ([[]).  This is
very handy for spaces at the end of regular expressions in config files
(like a slrn scorefile).

Re: slrn: how do I match "["?
#50489
Author: Heikki Kantola
Date: Mon, 09 Aug 1999 00:00
22 lines
1711 bytes
Mike Mulvaney <mike@asdf.asdf> informed
news.software.readers with the following:
>I'm pretty used to regexps in perl and grep, but I am having a problem
>in s-lang.  I am trying to match the character "[", and I can't get it
>to work.  I tried \[, which gives me some error messages.
>                  ^
>Here is the line:
>
>   n = string_match(str, "/[", 1);
>                          ^
>Slrn tells me there is an illegal parameter.  How can I do this?

By pressing wrong key perhaps? :) 
The \-escape works fine at least on my score file...

-- 
Heikki "Hezu" Kantola, <Heikki.Kantola@IKI.FI>
L�hett�m�ll� mainoksia tai muuta asiatonta s�hk�postia yll� olevaan
osoitteeseen sitoudut maksamaan oikolukupalvelusta FIM500 alkavalta
tunnilta.

Re: slrn: how do I match "["?
#50499
Author: Mike Mulvaney
Date: Mon, 09 Aug 1999 00:00
18 lines
1263 bytes
Earlier, Sven Gottwald <svengo@gmx.net> wrote:
>Mike Mulvaney <mike@asdf.asdf> schrieb/wrote:
>
>>I'm pretty used to regexps in perl and grep, but I am having a problem
>>in s-lang.  I am trying to match the character "[", and I can't get it
>>to work.  I tried \[, which gives me some error messages.
>
>You should use '\[' instead of '/['.

Doh!  I originally had \[, and switched to /[ as a test just before I
posted.  \[ doesn't work for me, either.

\( works fine, so maybe this is a bug?  I thought that maybe [ was
special in some other way.

Mike

Re: slrn: how do I match "["?
#50505
Author: Mike Mulvaney
Date: Mon, 09 Aug 1999 00:00
16 lines
1248 bytes
Earlier, Dawn Owens-Nicholson <bluemoon@ux6.cso.uiuc.edu> wrote:
>Why the fake e-mail address?  Your ISP should stop spam for you.

Actually, I don't usually use this account to post.  I didn't even
bother to check what my email address was going to be.

>In a regex you can also use a 1-character character class ([[]).  This is
>very handy for spaces at the end of regular expressions in config files
>(like a slrn scorefile).

That works for me.

Thanks,
Mike

Re: slrn: how do I match "["?
#50526
Author: John E. Davis
Date: Tue, 10 Aug 1999 00:00
15 lines
1027 bytes
On Mon, 09 Aug 1999 05:19:02 GMT, Mike Mulvaney <mike@asdf.asdf>
>   n = string_match(str, "/[", 1);

Try:

   n = string_match (str, "/[[]", 1);

The next version of slang will support:

   n = string_match (str, "/\\[", 1);

--John
   

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads