"Randy W. Sims" wrote: > > On 3/8/2004 8:35 AM, Hemond, Steve wrote: > > > > 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)/
You are missing '60', it should be: /SP(6[0-4]|[1-5]?\d)/ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
