:  Krishna, Hari wrote:
:  
:  > Hello again,
:  > 
:  > How can I find a word between two words.
:  > 
:  > I have a string like 
:  > 
:  > Name: NEWYORK, MARSStudy Date: 04/20/2004 03:06 PM
:  > 
:  > How can I extract 
:  > Name: NEWYORK, MARS
:  > Study Date: 04/20/2004 03:06 PM

You need to know a little bit about the field names. For example,
if they're always a series of capitalized words with a space between
them, you can turn it into a hash like this:

$_ = 'Name: NEWYORK, MARSStudy Date: 04/20/2004 03:06 PM';
%myhash = split(/([A-Z][a-z]+(?:\s[A-Z][a-z]+)*:\s*)/);

If your field names are a little more flexible than that, you'll
need to adjust the regex in the split.

If you have regex questions frequently, I refer you to Friedl's
excellent _Mastering Regular Expressions_. You will deepen your
understanding immensely.

Good luck,

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]
 
          Carleton Inc.   http://www.carletoninc.com
          574.243.6040 ext. 300    fax: 574.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
***** Please note that our Area Code has changed to 574! *****  




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to