obsidian-regex-replace icon indicating copy to clipboard operation
obsidian-regex-replace copied to clipboard

Auto remove "\n" in replace column?

Open alan120364 opened this issue 3 years ago • 5 comments

It is found that the "\n" characters in replace column will be removed automatically after find and replacement every single time.

It confuses me because I have to enter the "\n" character back every time.

Example:

  • Find: \n
  • Replace: \n\n

And then the "\n" in replace column is removed and I need to enter it back:

  • Find: \n
  • Replace:

I am using version 1.2.0 plugin and obsidian in macOS Monterey v12.3.1.

alan120364 avatar May 13 '22 10:05 alan120364

Thanks for the report! I'm able to reproduce the issues with my environment

Gru80 avatar May 14 '22 18:05 Gru80

Thanks, also appreciate for creating the plugin. :)

alan120364 avatar May 17 '22 07:05 alan120364

+1 To replace \n I was searching a plugin, but to find it's not working. T_T

lesca avatar Jun 22 '22 07:06 lesca

+1 I've noticed this as well. Sometimes it becomes an issue where I need to replace many sections of text with something that includes \n. For each replacement I have to manually retype the \n again.

T348IGYU avatar Apr 23 '23 08:04 T348IGYU

+1 Confirm this happens with plugin 1.2.0 on the Linux AppImage and Windows versions (Obsidian 1.4.13). In case it helps...

My plugin configuration:

  • Enabled
    • "Process \n as line break"
    • "Use regular expressions" (in search popup)
  • Disabled
    • "Case Insensitive"
    • "Prefill Find field"

Simple examples:

  1. Search \n\n+ and Replace \n\n, run, and reopen. Replace is now empty.
  2. Search \n## (|Part )(\d+) and Replace \n## Chapter $2, run, and reopen. Replace is now: ## Chapter $2.

All entries of \n in the Replace field are removed when the plugin is reopened. Everything else appears normally.

couladin avatar Sep 20 '23 18:09 couladin