Unclear what you are really trying to do.  Before compiling, you
need to insure that the Network has a starting number and then after that,
it should increment by 1.

        Can code be sucked into an array and worked with from there? Or
should the script find the first entry which matches your criteria and ask
if this is the starting point?  If so, then you can use that number and then
need only to search for the setup of

        if ( s/^\s+\/\* Network <)(\d+)>:/$1${MyNetworkNbr)>:/i ){
          $MyNetworkNbr++;
             }

        So either this may help or show what the data looks like and what
you want it to look like after making changes.

Wags ;)
-----Original Message-----
From: Alexei Lioubimov [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 11, 2002 03:26
To: [EMAIL PROTECTED]
Subject: How to write a Regex to modify numbers in the particular context
within a file?


Hello,
I'm trying to solve the following task:

In a .c source file among others I have some comments of special form:

    <some blanks> /* Network <number>:

These comments marks special peaces of source code. <number> is a number,
that must be incremented in succession in every "Network". During the
programming user can add, delete and insert the "Networks" (marked pieces of
code) - so it's necessary to renumber all Networks.

The problem is: I found out that it is impossible to use quantifier + in
(?<=) assertion and I can not force Perl to "lookbehind" when the number of
blanks is not defined yet.
Then, how can I pick the <number> and replace it with some needed value
within s/.../.../ ?

Thank you,
Alexei Lioubimov


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to