Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- regular expression problem
November 3, 2005, 5:46 pm
rate this thread
Does anyone know if it's possible to use regular expressions to grab
all content between two words. For example....
This is some example text to illustrate my problem and here's another
my for you.
I want to grab all text between the words 'some' and 'my' with the
correct result being ' example text to illustrate '
The following doesn't work with either ereg or preg_match...
Anyone got any ideas? Is this even possible with regular expressions?
Thanks in advance,
Re: regular expression problem
depends what you mean by 'word', a term which has various meanings.
1 approach to match what's between what's sometimes called orthographic
words could be:
the same as Sandman's but with assertions that the sequences <some> and
<my> are in fact orthographic words, that is, at both ends of each are
"word" boundaries (as defined by PHP). without these assertions the
sequence <my> appearing before the word <my> would throw the match.
because it's a match for <some>, then one or more of any character except
'(', 'm', 'y', or ')' until the last occurrence of <my>.
character classes are not ordered, they're lists of individual characters.
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum