Does anyone know of a regex that can be used to add a trailing space to every segment in a file in Studio?

I'm trying to find a regex that will be capable of adding a trailing space at the end of every segment in a file in Studio. Does anyone know of a regular expression that would do the trick? Thanks!

Parents
  • If you want to avoid having more than one space at the end of the segment in case there is already one, try this (without the quotes):

    • Search: "([^ ])$"
      Any character but a normal space before the end of line in a capturing group
    • Replace: "$1 "
      Backreference to last character from search capturing group followed by a normal space

    I also tried to search with a negative lookbehind "(?<! )$", but it does not seem to work in Studio (but works fine in Notepad++), unless I am missing something.

Reply
  • If you want to avoid having more than one space at the end of the segment in case there is already one, try this (without the quotes):

    • Search: "([^ ])$"
      Any character but a normal space before the end of line in a capturing group
    • Replace: "$1 "
      Backreference to last character from search capturing group followed by a normal space

    I also tried to search with a negative lookbehind "(?<! )$", but it does not seem to work in Studio (but works fine in Notepad++), unless I am missing something.

Children