in reply to Capturing text between literal string delimiters (was: Regular expressions)

m/sp\s([\w|\s|\?|\!]?)\ssp.*sp\s([\w|\s|\?|\!]?)\ssp/i

So that $1 is "Hello there" and $2 is "How are you" (I think). What's the newline character for? Of course, regular expressions sometimes elude me so this could be wrong. Try it, and see what the other monks say.

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Re: Regular expressions
by kidd (Curate) on Jun 24, 2002 at 12:48 UTC
    I just created the account, im the one who posted the message, the thing is that $string its just an example, in reality its a big text with a lot of lines, wich have delimiters...but what I want its to get only the words inside the delimiters, wich can be anything.
      If the Source File you mean does not change very often it might be easier to preprocess that once and convert its contents into a more handy format (plain text file where the line separator, separates your terms, or an xml file)or even save those into a faster format (eg. a BerkleyDB file or aven an RDBMS), so you might save some cpu and memory ressources when processing actaully the data.

      Have a nice day
      All decision is left to your taste