Announcement

Collapse
No announcement yet.

PTreed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lance Edmonds
    replied
    Although this is the wrong forum for these discussions, I should point out that REGEXPR and REGREPL are not case-sensitive by default, but adding the \c option will force REGEXPR/REGREPL to become case-sensitive.

    Yes, there are often plenty of ways to skin the proverbial cat...



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Michael Mattias
    replied
    .. using REGEXPR would be a significant overkill..
    I did say, "Take a look," not "REGEXPR is better."

    But were REGXPR available...you will note that REGEXPR can "automatically" do word extractions by using tags, and that's what this application is doing. Limitation? REGEPXR is not case-sensitive, as are INSTR and TALLY. Overkill? Hardly. Using REGREPL eliminates all the code needed to 'assemble' multiple words into the desired output, as well as the code needed to extract the words, once INSTR has located them.

    If one is uncomfortable with REGEXPR for word extraction, PARSE$ would also be worth looking at - but PARSE$ is not availalble in PB/DOS, either.

    Point is, there's more than one way to skin a cat.

    MCM

    Leave a comment:


  • Lance Edmonds
    replied
    Then I need additional to Ptreed with over 40KB memory space my own slower but functionable sub with instr()...
    Then I suggest you might want to revise your app design slightly.

    If you need to be able to search for any word, then you should create a (separate?) index file containing all the words... that way you can still perform a look-up of any word with blazing speed.

    Michael, assuming that PB/DOS did support REGEXPR, I find your advice to be "interesting"... for simple searches such as mentioned above where INSTR is perfectly suited, using REGEXPR would be a significant overkill. That is because REGEXPR incurs significant overhead compared to INSTR, due to it's complex underlying functionality.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Michael Mattias
    replied
    Instead of INSTR-based code, take a look at REGEXPR. It's really useful for finding "text strings inside of text strings."

    LATER:
    OOPS... never mind, no REGEXPR in PB/DOS.
    I guess I've been Windowfied.

    MCM


    [This message has been edited by Michael Mattias (edited June 09, 2002).]

    Leave a comment:


  • Matthias Kuhn
    replied
    Thanks,

    Lance and Mel for advance, but I´m disappointed about PTreed.

    Then I need additional to Ptreed with over 40KB memory space
    my own slower but functionable sub with instr()...

    Regards

    Matthias Kuhn

    ------------------

    Leave a comment:


  • Mel Bishop
    replied
    Originally posted by Lance Edmonds:
    If your index has a key length of say, 100 bytes, then
    searching with shorter string will perform a "partial match".
    For example, doing a FindFirst on "The" will match "The alpha
    version", "The beta edition", "Theology", etc.
    One other thing: If you want to find an exact match for the word
    "THE", put put a space before and/or after the word. In Lance's
    example above, the search " THE " (with spaces) will not find
    "Theology".

    The only down side is you will have to take special attention if
    the word you are looking for happens to be the first or last
    word of the sentence.

    If the word is the 1st word of the sentence, i.e., "The quick
    brown fox", the leading space in my example above will preclude
    finding it.



    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    If your index has a key length of say, 100 bytes, then searching with shorter string will perform a "partial match". For example, doing a FindFirst on "The" will match "The alpha version", "The beta edition", "Theology", etc.

    Importantly, partial matches must match from the start of the string -- it is not possible to do a FindFirst() on a keyword occurring in the middle of an index key. On this basis, PowerTREE does not support multi-matches like "The AND fine".

    However, since partial matches are possible, you can emulate it like this:

    1. FindFirst() on "The"
    2. Perform an INSTR() on the resulting index key to see if it contains "fine"
    3. FindNext()
    4. Repeat from step #2 until no more partial key matches are found.

    Yes, you can have as many open index files are the Operating system permits (tyically this is 15 for DOS, unless you extend the maximum open files setting).

    The "trick" is to maintain a separate KeyBlock UDT for each index file you have open.

    I hope this helps!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Matthias Kuhn
    started a topic PTreed

    PTreed

    Hi,

    is it possible to do following with PTreed using ptFF:

    Key$="NOW THE WEATHER IS FINE" for example

    1) Finding the key$ with the search word "THE"
    2) Finding the key$ with the search words "THE" and "FINE"
    3) And how ?

    Is it possible to open more as one PTinit´s together ? How much max ?

    Thanks for answere.

    Regards

    Matthias Kuhn


    ------------------
Working...
X