How to generate sequence numbers using replacement format strings

How to generate sequence numbers using replacement format strings

49
Basic UserBasic User
49

    Mar 21, 2016#1

    How to generate sequence numbers using replacement format strings in UEStudio 11.00.0.1011 like TextPad 8.0.2 (32-bit edition)

    In TextPad 8.0.2 in build feature:
    TextPad wrote:You can update or insert sequence numbers, using replacement format strings on the Replace dialog box, with the Regular expression option checked.

    The syntax of the \i replacement format is: \i{start,increment,width,fillchar}

    where start and increment are signed integers, width is an unsigned integer, and fillchar is any character, but normally space or '0'.

    Without any qualifiers, \i is equivalent to \i{1,1,0, }.

    Expression: Effect:
    \i Replace with numbers starting from 1, incrementing by 1.
    \i{10} Replace with numbers starting from 10, incrementing by 1.
    \i{0,10} Replace with numbers starting from 0, incrementing by 10.
    \i{100,-10} Replace with numbers starting from 100, decrementing by -10.
    \i{1,1,3,0} Replace with numbers starting from 1, incrementing by 1. The numbers will be right justified in a width of 3 characters, zero filled.

    Note that if more than one \i expression is used in a replacement format, they increment independently of each other.

    Examples:
    1. To insert line numbers at the start of each line:
      Search for: ^
      Replace with: \i
    2. To update sequence numbers of the form Axxx, Bxxx, ..., Zxxx where "xxx" is any number >= 100, independent of the letters, which are to be preserved:
      Search for: (\u)[1-9]\d{2,}
      Replace with: $1\i{100}
    PLEASE implement this feature in UEStudio. It would be a very useful feature!

    6,604548
    Grand MasterGrand Master
    6,604548

      Mar 22, 2016#2

      In UltraEdit / UEStudio there is Column - Insert Number. But if the incrementing number must be inserted on several different columns in active file like an incrementing identifier number which must be found with a regular expression executed in a loop from top to bottom of file, a script must be used for this task.

      It would be of course possible to enhance all UltraEdit and UEStudio versions supporting scripts with the feature offered by TextPad. Someone just have to take about 10 to 20 hours to write the script for general usage and share it with the UE / UES user community.

      As there were in the past already several questions on how to replace a string by an incrementing number or find already existing numbers and increment them, writing such a script for general usage is on my to do list when I have some time and feel like coding that script. But it was always faster for me to write the script for the specific task than writing a general script because it just takes me 5 to 10 minutes to code the few lines required for inserting or replacing an incrementing number in file.

      See what an advanced search finds with search expression +increment* +number* with Scripts forum selected. Those posted scripts can be very easily modified as in most of them just the search expression string must be modified.
      Best regards from an UC/UE/UES for Windows user from Austria