Replacing capturing group in between two numbers RRS feed

  • Question

  • Hi,

    I've been looking all over but I couldn't find a way to perform the following substitution in visual studio 2010 (vb.NET):

    input: "GU01
       215.202   229.851     0.000    0"

    pattern: "GU0([1234]\s[\s\d\.]*) 0.000"

    replacement: "GU0$16569.0"

    I want to have "GU01
       215.202   229.851    6569.0    0"

    What happens is that VB doesn't know if I'm refering to $1 (group number 1) or $16569 (group number 16569) on the replacement string. How do I solve that without using \b? I always end up with "GU0$16569.0" in place of the whole thing instead of having the group 1 read.



    Monday, February 4, 2013 9:40 PM


  • Hi Bernardo,

    Welcome to the MSDN Forum.

    Try to add one space between $1 and 6569.0 like this:

    $1 6569.0

    And I modified your pattern like this:

    (GU0[1234]\s[\s\d\.]*) 0.000

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Mike Feng Thursday, February 14, 2013 10:00 AM
    Tuesday, February 5, 2013 9:28 AM