TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: KYLE WATKINS
date: 1998-02-07 04:17:00
subject: Re: regular expressions

From: Kyle Watkins 
Jorj Strumolo[SMTP:jorj@wsii.com] wrote:
>  of the 22,000 newsgroups on this server, trying to find
>  groups with names over the 14-character unit limit,
>  such as "alt.conspiracy.new-world-order" where
>  "new-world-order" has 15 characters after the last dot.
> 
>  I could do a search for   \.[0-9a-z_+-]#.*      , that is,
> 
>  a dot followed by *1* or more occurrences of 0-9, a-z, _ or +
>  or -, optionally followed by a '.' if the string wasn't the last
>  part of the name.  I couldn't find a way to limit it to *15*
>  or more occurrences of the first range.  Is there one?
> 
  Hi Jorj,
  The regular expression engine allows a maximum of 10 classes to be
  specified in an expression, so you will NOT be able to list
  [0-9a-z_+\-] fifteen times (as you need) at this time, sorry.  I'll
  make a note of this for the regular expressions "wish list".
  As an alternative, I've thrown together a couple of sample macros you
  may want to adjust to your needs.  Both of the macros,
  check each found "item" to see if the characters exceed 14.
//  The first macro places the cursor at the next position to the right
//  of the found string, so repeated calls always go to the next occurrence.
//
//  The second macro takes parameters, so that you can make it work similar
//  to the the "find" and "repeatfind"
proc findstr1()
    integer quit = FALSE
    while not quit
        if lfind("\.\c{[0-9a-z_+\-]#}\.?","x")
            if length(getfoundtext(1)) > 14
                HiLiteFoundText()
                quit = TRUE
            endif
        else
            quit = TRUE
            message("STRING NOT FOUND")
            alarm()
        endif
    endwhile
end
proc findstr2(integer start)  // if start > 0, the find will start
    integer quit = FALSE      // at character after cursor position,
                              // otherwise it starts at cursor pos.
    while not quit
        if lfind("\.{[0-9a-z_+\-]#}\.?",iif(start,"+","")+"x")
            start = 1
            if length(getfoundtext(1)) > 14
                HiLiteFoundText()
                quit = TRUE
            endif
        else
            quit = TRUE
            message("STRING NOT FOUND")
            alarm()
        endif
    endwhile
end
// sample key assignments
  findstr1()      // starts at cursor pos. , but macro places
                              // cursor at next char. from found string start
  findstr2(0)    // starts at cursor pos. on repeated use
  findstr2(1)    // starts at cursor pos. +1 on repeated use
// sample test TEXT (adjusted) from your message
//  such as "alt.conspiracy.new-world-ord15
//  such as "alt.conspiracy.new-world-ord15"
//  such as "alt.conspiracy.new-world-orde"
//  such as "alt.conspiracyxxxxx17.new-world-ord15"
//  such as "alt.conspiracyxx14.new-world-ord15"
//  such as "alt.conspiracyxxxxxxx.new-world-or"
Kyle Watkins (SemWare Support)
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.