Thread View: news.software.readers
17 messages
17 total messages
Started by Jurriaan W Kalkman
Sat, 25 Mar 2000 00:00
[slrn] possible to use 'or' expression in s-lang regular expression?
Author: Jurriaan W Kalkman
Date: Sat, 25 Mar 2000 00:00
Date: Sat, 25 Mar 2000 00:00
26 lines
1497 bytes
1497 bytes
Is it possible to score either Get Rich Quick Get Rich Fast with Subject: Get Rich Quick|Fast or something like that? I know this is of no importance to scoring, since or-rules exist, but it'd be interesting to know for another idea I just had (and posted) about a user-defined regular expression for url-finding. I can find no info about this in either the slrn or the slang-docs, and searching dejanews didn't help either. Greetings, Jurriaan -- Never use "etc." -- it makes people think there is more where there is not or that there is not space to list it all, etc. Linux 2.2.15pre14 SMP up 7:51 4 users load av: 0.40 0.43 0.52
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Dawn Owens-Nicholson
Date: Sat, 25 Mar 2000 00:00
Date: Sat, 25 Mar 2000 00:00
28 lines
1431 bytes
1431 bytes
Jurriaan W Kalkman wrote:
> Is it possible to score either
>
> Get Rich Quick
> Get Rich Fast
>
> with
>
> Subject: Get Rich Quick|Fast
>
> or something like that?
You're probably thinking of "Get Rich (Quick|Fast)". But you can't do
alternation in S-Lang regular expressions. If you're writing S-Lang, use
orelse:
if (orelse
{ string_match (subject, "Get Rich Quick", 1) }
{ string_match (subject, "Get Rich Fast", 1) })
{
.
.
.
}
Or you could link in another regex engine and use its syntax.
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thomas Schultz
Date: Sat, 25 Mar 2000 00:00
Date: Sat, 25 Mar 2000 00:00
12 lines
1222 bytes
1222 bytes
On 25 March 2000, Dawn Owens-Nicholson <bluemoon@ux6.cso.uiuc.edu> wrote: [...] > Or you could link in another regex engine and use its syntax. Did anyone actually manage to do this? Is he/she willing to give a brief description of how to do it or even make a patch available? The limited regex syntax is currently my "least favourite" feature of slang. -- Thomas Schultz <tststs@gmx.de>
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thomas Schultz
Date: Sun, 26 Mar 2000 00:00
Date: Sun, 26 Mar 2000 00:00
17 lines
1704 bytes
1704 bytes
On 26 March 2000 at 03:54 GMT, Thorfinn <thorfinn@netizen.com.au> wrote: [...] > In any case, the only two RE libraries that would seem viable would > be the perl one and the GNU regexp one. I'd investigate those two, > and see what their capabilities are. What about PCRE�? It offers perl-compatible syntax, is successfully used by programs on both Unix (e.g. exim) and Windows (e.g. XNews), but it is not part of perl and has a permissive license that should make it possible to distribute it under both the Artistic License and the GPL. [1] ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ -- Thomas Schultz <tststs@gmx.de>
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Walter Dnes
Date: Sun, 26 Mar 2000 00:00
Date: Sun, 26 Mar 2000 00:00
44 lines
3250 bytes
3250 bytes
On 26 Mar 2000 16:44:57 GMT, davis@space.mit.edu (John E. Davis) wrote in article <slrn8dsfk7.aud.davis@aluche.mit.edu>: > I do not see any VMS support. It is inconceivable for me to > use regular expressions in code that are not supported under > all the operating systems that the slrn supports. This has > been the main reason for me not adopting any other regular > expression library. I will not abandon users of some of these > other systems simply to give other users the luxury of more > sophisticated regular expressions. No one's asking you to abandon anybody. Make s-lang the "floor" for those who have no real regexp support in their OS. But don't make it the "ceiling" and disallow better regexp support where it does exist. As I understand it, text is fed into a "regexp engine" blackbox, and a binary "yes-it-matches/no-it-doesn't-match" result is returned. This looks like an ideal situation to implement an "ifdef" based on the OS. Unix-type OS's could link in native regexp support for the blackbox. Windows-type OS's could link in GNU libraries for the blackbox. s-lang would probably still have to be linked in anyways to handle other portions of slrn/slrnpull. VMS/etc would be compiled to see the regexp engine "module" as a passthrough call to s-lang as "regexp engine of last resort". Yes, the score files would be different in different OS's. Then again, I don't really expect to take a linux script that runs slrnpull/slrn and execute it as a DOS batchfile. While we're talking about enhancements. I have an ATI card that can run 132 columns X 44 rows *TEXTMODE*. I would love to have an option to place the thread window in the first 50 columns and the article pane in the last 80 columns. Currently, I only see documentation re: panes one above the other. -- Walter Dnes <waltdnes@waltdnes.org> http://www.waltdnes.org SpamDunk Project procmail spamfilters. A picture is worth a thousand words; unfortunately, it consumes the bandwidth of ten thousand words.
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: John E. Davis
Date: Sun, 26 Mar 2000 00:00
Date: Sun, 26 Mar 2000 00:00
15 lines
1342 bytes
1342 bytes
On 26 Mar 2000 03:54:57 GMT, Thorfinn <thorfinn@netizen.com.au> wrote: >> 2. The regexp code must support UTF-8. > >Hrm. Support it in what way? Perl does Unicode, and... well, it's 8 The regexp `.' matches a single character. A single character may be represented by several bytes in the UTF-8 encoding. How many regexp libraries assume that a single character is represented by a single byte? Thanks, --John
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thorfinn
Date: Sun, 26 Mar 2000 00:00
Date: Sun, 26 Mar 2000 00:00
40 lines
2811 bytes
2811 bytes
In news.software.readers, on 26 Mar 2000 03:16:53 GMT
John E. Davis <davis@space.mit.edu> wrote:
> On 25 Mar 2000 21:46:55 GMT, Thomas Schultz <tststs@gmx.de>
> wrote:
> >limited regex syntax is currently my "least favourite" feature of
> A related question: how many regexp packages support UTF-8? Version
> 2.0 of slang will support UTF-8 and before I improve the regexp code
> or adopt a different regexp library for version 2.0, the following
> requirement will have to be met:
> 1. The regexp code must be availble for all systems supported by
> slang and be usable (i.e., bug-free) : Unix, VMS, OS/2, Win32,
> BeOS, ...
I'm not certain how separated the perl RE library is from the perl
sources, since I've not investigated it, but certainly perl is ported
to those listed platforms, IIRC. Hrm. Actually, I'm not *certain*
about a VMS port, but it shouldn't be too hard to find out from
perl.com.
> 2. The regexp code must support UTF-8.
Hrm. Support it in what way? Perl does Unicode, and... well, it's 8
bit clean, which I guess means it does UTF-8, but I don't actually
know for sure.
In any case, the only two RE libraries that would seem viable would be
the perl one and the GNU regexp one. I'd investigate those two, and
see what their capabilities are.
Later,
Thorf
--
David Goh <thorfinn@netizen.com.au> -- http://netizen.com.au/
Internet and Open Source Development, Consulting and Training
Netizen Pty Ltd, GPO Box 2265U, Melbourne VIC 3000, Australia
Telephone: +61-3-9614-0949 Facsimile: +61-3-9614-0948
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: John E. Davis
Date: Sun, 26 Mar 2000 00:00
Date: Sun, 26 Mar 2000 00:00
14 lines
1515 bytes
1515 bytes
On 26 Mar 2000 15:25:36 GMT, Thomas Schultz <tststs@gmx.de> wrote: >used by programs on both Unix (e.g. exim) and Windows (e.g. XNews), I do not see any VMS support. It is inconceivable for me to use regular expressions in code that are not supported under all the operating systems that the slrn supports. This has been the main reason for me not adopting any other regular expression library. I will not abandon users of some of these other systems simply to give other users the luxury of more sophisticated regular expressions. --John
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: John E. Davis
Date: Sun, 26 Mar 2000 00:00
Date: Sun, 26 Mar 2000 00:00
18 lines
1424 bytes
1424 bytes
On 25 Mar 2000 21:46:55 GMT, Thomas Schultz <tststs@gmx.de>
wrote:
>limited regex syntax is currently my "least favourite" feature of
A related question: how many regexp packages support UTF-8? Version
2.0 of slang will support UTF-8 and before I improve the regexp code
or adopt a different regexp library for version 2.0, the following
requirement will have to be met:
1. The regexp code must be availble for all systems supported by
slang and be usable (i.e., bug-free) : Unix, VMS, OS/2, Win32,
BeOS, ...
2. The regexp code must support UTF-8.
Thanks,
--John
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thorfinn
Date: Mon, 27 Mar 2000 00:00
Date: Mon, 27 Mar 2000 00:00
37 lines
2869 bytes
2869 bytes
In news.software.readers, on 26 Mar 2000 16:21:54 GMT John E. Davis <davis@space.mit.edu> wrote: > On 26 Mar 2000 03:54:57 GMT, Thorfinn <thorfinn@netizen.com.au> > wrote: > >> 2. The regexp code must support UTF-8. > >Hrm. Support it in what way? Perl does Unicode, and... well, it's 8 > The regexp `.' matches a single character. A single character may be > represented by several bytes in the UTF-8 encoding. How many regexp > libraries assume that a single character is represented by a single > byte? Well, the perl one presumably can't assume that . is one byte, since it does unicode things, and IIRC, unicode has multibyte characters. I don't know whether it does so for UTF-8 or not, nor am I actually clear enough on the difference between Unicode and UTF-8 to be able to give you a real answer. Go prod at the library source. And, as other people have said, yes, there may not be full support across all platforms that slang is on for a specific RE library... but having the option to link in a different RE library at compile time instead of using slang's would be *really* nice. Sure, that library may not be available for VMS or whatever, but it'd be a *huge* bonus in functionality for the platforms that do have a much improved RE library. Later, Thorf -- David Goh <thorfinn@netizen.com.au> -- http://netizen.com.au/ Internet and Open Source Development, Consulting and Training Netizen Pty Ltd, GPO Box 2265U, Melbourne VIC 3000, Australia Telephone: +61-3-9614-0949 Facsimile: +61-3-9614-0948
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: John E. Davis
Date: Tue, 28 Mar 2000 00:00
Date: Tue, 28 Mar 2000 00:00
29 lines
2494 bytes
2494 bytes
On 28 Mar 2000 14:30:12 GMT, Thomas Schultz <tststs@gmx.de> wrote: >It was already pointed out by others that one could add a compile-time >option to chose between the builtin RegExp support and an external >library like pcre. My impression is that this thread concerned the enhancement of regular expressions within slang library and not in slrn itself. For applications such as slrn, it is trivial to add support for a different regular expression library. I have no argument with that. If you want to send me patches to that allow one to use, say pcre, instead of slang regular expressions, then I will integrate those patches because it is a no-brainer. Of course such patches must include changes to Makefile.in, configure.in, etc. However, replacing the slang library regular expressions with an off the shelf package _within_ the slang library is far from trivial, requiring many considerations that standalone applications such as slrn do not have to deal with. Chief among them are portability, a clean well-defined interface, and compatibility with the long term future of the library. In fact, I would be highly surprised if you were able to patch the slang library with a different RE library and still keep a portable interface. Remember, it is because of the portability of this interface that slrn was ported to win32, VMS, OS/2, and BeOS. My argument is that I want to keep it that way. --John
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thomas Schultz
Date: Tue, 28 Mar 2000 00:00
Date: Tue, 28 Mar 2000 00:00
20 lines
1839 bytes
1839 bytes
On 26 March 2000 at 16:44 GMT, John E. Davis <davis@space.mit.edu> wrote: > On 26 Mar 2000 15:25:36 GMT, Thomas Schultz <tststs@gmx.de> wrote: >> used by programs on both Unix (e.g. exim) and Windows (e.g. XNews), > I do not see any VMS support. The documentation of pcre says that it is entirely written in standard C, so porting it to even more operating systems might well be easier than implementing advanced RegExp syntax in slang. > [...] I will not abandon users of some of these other systems simply > to give other users the luxury of more sophisticated regular > expressions. It was already pointed out by others that one could add a compile-time option to chose between the builtin RegExp support and an external library like pcre. -- Thomas Schultz <tststs@gmx.de>
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thomas Schultz
Date: Wed, 29 Mar 2000 00:00
Date: Wed, 29 Mar 2000 00:00
36 lines
2787 bytes
2787 bytes
On 28 March 2000 at 17:03 GMT, John E. Davis <davis@space.mit.edu> wrote: [...] > If you want to send me patches to that allow one to use, say pcre, > instead of slang regular expressions, then I will integrate those > patches because it is a no-brainer. Of course such patches must > include changes to Makefile.in, configure.in, etc. I am willing to write such a patch; however, I might not find time for it until my exams are over (17th of May). If someone else wants to give it a try, please drop me a note so that no duplicate work is done. [...] > In fact, I would be highly surprised if you were able to patch the > slang library with a different RE library and still keep a portable > interface. [...] I think I see your point. It would not be possible to write portable programs using slang if the behavior of SLang_regexp_match et al. depended on a compile-time option of slang. Then, what about having _additional_ RegExp functions in slang which encapsulate pcre (or similar packages) where available and use the native slang routines otherwise? When full portability is needed, developers could use slang RegExps. An example of this in slrn would be the parsing of error messages from the newsserver. In other situations, developers could chose to let users work with whichever syntax they are more accustomed to. An example of this would be the scorefile functions in slrn which could use the new, customizable RegExp functions in slang. Having such functions in slang would spare us the job of encapsulating pcre in every single application that might want to use it. -- Thomas Schultz <tststs@gmx.de>
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: John E. Davis
Date: Wed, 29 Mar 2000 00:00
Date: Wed, 29 Mar 2000 00:00
41 lines
2434 bytes
2434 bytes
On 29 Mar 2000 13:30:33 GMT, Thomas Schultz <tststs@gmx.de>
wrote:
>I think I see your point. It would not be possible to write portable
>programs using slang if the behavior of SLang_regexp_match et al.
>depended on a compile-time option of slang. Then, what about having
>_additional_ RegExp functions in slang which encapsulate pcre (or
>similar packages) where available and use the native slang routines
>otherwise?
Assuming that I understand what you are saying, this would not work
for several reasons:
1. A wrapper would be required that maps either the slang RE
syntax to pcre syntax, or visa versa.
2. The code using this new interface could only use the what is
supported by both slang and pcre, i.e., effective slang REs.
3. To get around the problem with #2, the application code could
use something like:
#v+
#if SLANG_HAS_PCRE
SLnew_re_interface (sophisticated RE);
#else
SLnew_re_interface (slang RE);
possibly_more_code ();
#endif
#v-
4. If one must put such code into the application, then why not
just use pcre directly:
#v+
#if USE_PCRE
pcre_whatever (...);
#else
SLang_regexp_match (...);
possibly_more_code ();
#endif
#v-
--John
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thomas Schultz
Date: Thu, 30 Mar 2000 00:00
Date: Thu, 30 Mar 2000 00:00
34 lines
2685 bytes
2685 bytes
On 29 March 2000 at 17:41 GMT, John E. Davis <davis@space.mit.edu> wrote: > Assuming that I understand what you are saying, this would not work > for several reasons: > 1. A wrapper would be required that maps either the slang RE > syntax to pcre syntax, or visa versa. [...] I think there is a misunderstanding. My idea is: 1. When compiling slang, the user (or his administrator) can decide what syntax he likes to use when he is asked to enter a regular expression. 2. To evaluate a regular expression the user has entered, we use SLnew_re_interface(). As the user himself chose the syntax, we can assume that the regular expression he provided does what he wants. I do not see why we should map it to slang RE or use any #if..#else..#endif directives in this case. 3. Evaluating such a user-defined RE can be done by simply calling SLnew_re_interface(). Currently (without this function), we need #if..#else..#endif whereever we want to make use of pcre and still be portable. 4. To evaluate hardcoded regular expressions (provided by the developer, e.g. to identify an error message), we go on using SLang_regexp_match() and slang syntax. In this case, we do not have to worry whether or not the user compiled in additional pcre support for himself (so no #if..#else..#endif is needed either). I hope I expressed myself more clearly this time. -- Thomas Schultz <tststs@gmx.de>
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: John E. Davis
Date: Sun, 02 Apr 2000 00:00
Date: Sun, 02 Apr 2000 00:00
21 lines
2115 bytes
2115 bytes
On 30 Mar 2000 14:27:26 GMT, Thomas Schultz <tststs@gmx.de> wrote: >1. When compiling slang, the user (or his administrator) can decide > what syntax he likes to use when he is asked to enter a regular > expression. > >2. To evaluate a regular expression the user has entered, we use > SLnew_re_interface(). As the user himself chose the syntax, we can > assume that the regular expression he provided does what he wants. > I do not see why we should map it to slang RE or use any > #if..#else..#endif directives in this case. You have to keep in mind that slang is not used only by slrn and jed. It is shipped as a shared library with all linux distributions. In such cases, the user or system administrator will not be in the position to select a particular syntax. In fact, this is the most likely scenario for the vast majority of linux users. --John
Re: [slrn] possible to use 'or' expression in s-lang regular expression?
Author: Thomas Schultz
Date: Wed, 05 Apr 2000 00:00
Date: Wed, 05 Apr 2000 00:00
28 lines
2638 bytes
2638 bytes
On 02 April 2000 at 19:53 GMT, John E. Davis <davis@space.mit.edu> wrote: [...] > You have to keep in mind that slang is not used only by slrn and jed. > It is shipped as a shared library with all linux distributions. In > such cases, the user or system administrator will not be in the > position to select a particular syntax. In fact, this is the most > likely scenario for the vast majority of linux users. We discussed two alternatives: The first one is implementing optional support for different regexp libraries (like pcre) in each individual slang application. The second one is encapsulating this functionality in slang. You now mention that when installing a binary linux distribution, the user (or administrator) will not be able to make the decision which regexp syntax to use himself. However, this applies to *both* alternatives: If you want to change the syntax, you have to recompile. But I still see a difference: When pcre support is in individual applications, you have to recompile every single application to change the syntax everywhere. If it is encapsulated in slang, it will suffice to recompile slang only (which is one single package in most distributions). I think this is an argument for the second alternative rather than for the first. -- Thomas Schultz <tststs@gmx.de>
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