Consulting

Results 1 to 10 of 10

Thread: "Search and Replace Regular Expressions"

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    "Search and Replace Regular Expressions"

    I am an Excel guy and Word really trips me up. I am trying to reorder references in a technical document. When it is created, they are just placed randomly (as in CURRENT below). But I need to reorder them such that the "R" value (always a capitol R followed by a number) appear in order (FINAL DESIRED below). When reordered, they need to be linked up properly within the document. I think what needs to happen is that should go through an an intermediate step (INTERMEDIATE below) to avoid conflicts and then do a find/replace to final desired order. I think the process would go something like this:

    - Find the first "R"+number (if less than 1000). For example, it could be R5.
    - Rename R5 to R1001 and replace all other instances of R5 with R1001
    - Start at beginning of document and find next "R"+number (if less than 1000) and change it to R1002. For the example, R8 would go to R1002.
    - Go through this process until there are no "R"+number less than R1000
    - Finally, rename R1001 to R1, R1002 to R2, etc. (I will manually add these).

    I can donate $40 to the forum for this help.

    -------------------------------------------------

    CURRENT:
    example text [R5, R8] more test text [R33,R2] and still some more [R1] but not done yet [R8, R2, R33] and [R2, R5] plus [R9]

    ---------------

    FINAL DESIRED:
    example text [R1, R2] more test text [R3,R4] and still some more [R5] but not done yet [R2, R4, R3] and [R4, R1] plus [R6]

    ------------

    INTERMEDIATE:
    example text [R1001, R1002] more test text [R1003,R1004] and still some more [R1005] but not done yet [R1002, R1004, R1003] and [R1004, R1001] plus [R1006]
    Last edited by ronjon65; 10-17-2015 at 03:07 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •