Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: Re: Skipping special tags in regexes

by fletcher_the_dog (Friar)
on Dec 04, 2003 at 23:19 UTC ( #312368=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Skipping special tags in regexes
in thread Skipping special tags in regexes

The only problem is that each word in a string may not be unique, so you couldn't just plop things in a hash. Also the regexes might introduce new words someplace in the string that alreay existed in the string somewhere else. That why I have tried using diffing, but it was just too slow.
  • Comment on Re: Re: Re: Skipping special tags in regexes

Replies are listed 'Best First'.
Re: Re: Re: Re: Skipping special tags in regexes
by CountZero (Bishop) on Dec 05, 2003 at 06:31 UTC
    That's true, but I was not necessarily thinking of using a hash.

    An array based datastructure would probably be OK and it has the added benefit of preserving the sequence of the words: this would make it a lot easier to construct the"untagged" sentence for regex-purposes and thereafter, one could split the regexed-sentence on whitespace and compare this list with the array made by splitting the "original" list.

    All you have to do then is to walk the original list, adding tags to the regexed-list where necessary and skipping the newly inserted words in the regexed-list. You might still have a problem in cases where you introduce duplicate words next to one another.


    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://312368]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2022-08-08 03:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found