Regular Expressions help
Joel Pearson
pearj at iprimus.com.au
Mon Dec 9 22:44:06 EST 2002
I should have included some more of the data to put it in context:
<option value=IMD> (IMDEX LIMITED) IMD          
     </option><option value=IMF> (IMF (AUSTRALIA) LTD) IMF
               </option><option
value=IMH> (IMT HOLDINGS LIMITED) IMH          
     </option><option value=IMI> (INTEGRA MEDICAL) IMI  
             </option><option value=IMIO>
(INTEGRA MEDICAL) IMIO              
 </option><option value=IMP> (IMPERIAL ONE LIMITED) IMP    
           </option><option value=IMPOB>
(IMPERIAL ONE LIMITED) IMPOB              
 </option><option value=IMPOC> (IMPERIAL ONE LIMITED) IMPOC  
             </option><option value=IMU>
(IMUGENE LIMITED) IMU              
 </option><option value=IMW> (INSURANCE MY WAY) IMW    
           </option><option value=INF>
(INFOSENTIALS LIMITED) INF              
 
All that data is on a single line, so I never have a short string
~~~~~~~~~~~~~~~~~~~~~~~
Joel Pearson
Email: pearj at writeme.com
ICQ:1580379
MSN: joelpearson at hotmail.com
-----Original Message-----
From: Alex Satrapa [mailto:grail at goldweb.com.au]
Sent: Monday, 9 December 2002 10:21 PM
To: pearj at writeme.com
Cc: Linux user group
Subject: Re: Regular Expressions help
Joel Pearson wrote:
> Just say I have this data "<option value=IMD> (IMDEX LIMITED) IMD",
> normally what happen is it pulls out IMB and IMDEX LIMITED.
>
What's the thing after the brackets? If it's always a short string, and
never has brackets, you might want to try:
"/value=(.{3})> \((.+)\)[^)]+$/"
That is, match everything from the first bracket after the
angle-bracket, to the last bracket before the end of the line.
HTH
More information about the linux
mailing list