Thanks to everybody for replying and for the good explanations. :-)

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestières
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED] 



 > -----Original Message-----
 > From: Randy W. Sims [mailto:[EMAIL PROTECTED] 
 > Sent: Monday, March 08, 2004 8:59 AM
 > To: Hemond, Steve
 > Cc: [EMAIL PROTECTED]
 > Subject: Re: Substitutions
 > 
 > 
 > On 3/8/2004 8:35 AM, Hemond, Steve wrote:
 > 
 > > Hi ppl,
 > > 
 > > In an HP/GL2 file, there is a command called SP (select 
 > pen) which is 
 > > associated to a pen number from 1 to 64. I have to parse 
 > the file and 
 > > insert a command after each select pen command.
 > > 
 > > Example : 10652PUPD515,10652PUPD515,2536PUSP61PU57531,8270PDPA57
 > >                                 ----
 > > 
 > > to : 
 > > 10652PUPD515,10652PUPD515,2536PUSP61;NEW_COMMAND;PU57531,8270PDPA57
 > >                                 ----------------
 > > 
 > > How can I search for either one digit after SP (for pen 
 > numbers from 1 
 > > to 9) or two digits (from 10 to 64) ?
 > > 
 > > My actual way of doing it is :
 > > s/SP(\d*)/SP$1;NEW_COMMAND;/)
 > > 
 > > In the case mentionned above, the subtitution won't work. 
 > d* doesn't 
 > > seem to be the correct way to search for digits after SP.
 > > 
 > > It has to find for one OR two digits after SP.
 > > 
 > 
 > /SP(6[1-4]|[1-5]?\d)/
 > 
 > SEE ALSO:
 >    Mastering Regular Expressions; O'Reiley
 > 
 > 
 > 
 > 

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


Reply via email to