# Requires "by":
$line = "daffromHello Worldby";
$line =~ /from(.*)(by)/;
print $1;

Not sure about making it optional.
Can always check if you got "" and then try without the "by"

On 5/14/07, Tom Allison <[EMAIL PROTECTED]> wrote:
How do I pull all the words from a line between the two words 'from' and 'by'
when I have NO IDEA what's in there, but I know they are all in one line.

To make it more difficult.  'by' is optional...

Like this:

from......by......
or
from......

I want all the stuff inside.

Initially I'm thinking
/from (.+?) (?:by (.+?))?/

Anything better?

I can negate a character  with [^b] to mean not-'b'
but can I negate a word?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to