Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


Regex replace, parentheses in replace with


  • Anonymous

    Hi ,
    in previous versions  if we replace something in regex mode with a sentence like (foo) parentheses is also included in result, but with the version 6, now parentheses in replace with string must be escaped with \ character. For repeat this try:

    -open a new document
    -write 1 in it
    -replace 1 with (foo) in regex mode
    -now document only includes foo (in old versions documents contains (foo) )

  • Yes, it's a side effect of the new regular expression support.  You answered your own question though - you can escape the parentheses with \.

    What it means, is that you can do advanced replaces:

    With the text

    hello test 153
    hello test word
    something test 63822
    something test wibble

    Search for:


    Replace with

    (?1NUMBERS:not numbers)

    ?1 says "if grouped expression 1 was matched, then replace with the following, otherwise replace with what comes after the ':'.

    For a full list of everything you can do, see http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

    So yes, you need to escape your parentheses for the replacement string, but you get a whole load of functionality in return.



  • Anonymous

    Thank you Dave,
    i am not aware of this new functionalities. Generally i do simple replacements with regex and i will miss unescaped replace with string, but new features are also cool.

  • BloodyRain2k

    I can confirm that this bug still exists in 6.1.4

  • If you read the rest of this thread, you'll see it isn't a bug.