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;/)
--------
Hi Steve,
I think you want \d+, which would match one or more digits. \d* will return
true even if there are none. It seems like you're expecting at least one.
hth
Jeff
--------
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.
Any ideas?
Thanks in advance,
Best regards,
Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>