atom / find-and-replace

Find and replace in a single buffer and in the project
MIT License
242 stars 219 forks source link

The Find/Replace feature does not work #1111

Closed Ephellon closed 4 years ago

Ephellon commented 4 years ago

Prerequisites

Description

When using the Ctrl + F or Ctrl + Shift + F (Find & Replace) with Regex enabled, the feature fails.

Steps to Reproduce

  1. Press Ctrl + F or Ctrl + Shift + F
  2. Use a valid Regex in the "Find" area, such as --\b or (--)\b
  3. Use a valid string in the "Replace" area, such as ? or $1?
  4. Notice that nothing will be replaced, or the replacement will be literal
    • such as --apple$1?apple; it should be --?apple

Expected behavior:

Replace the current buffer(s) with the valid replacement string.

Actual behavior:

Either replaces the buffer(s) will literals, or does not replace anything.

Reproduces how often:

100% of the time: Safe Mode, fresh install, etc.

Versions

OS Atom Node APM Electron Chrome
Windows 10 x64 1.43.0 v10.11.0 2.4.3 4.2.7 69.0.3497.128

Additional Information

Ephellon commented 4 years ago

Example of what I was trying to do:

Original index.html:

...
<meta --user="title. last-name"/>
...

Desired output:

...
<meta ?user="title. last-name"/>
...

Options used (Find & Replace):

Find in current buffer: --\b Replace in current buffer: ?

Ephellon commented 4 years ago

I can't just use -- due to HTML comments <!-- ... -->

Eli-Tarrago commented 4 years ago

I think this is a problem with your regex matching instead of the atom editor.

Try this regex match: ([^<!](-)\1+)

Ephellon commented 4 years ago

Hi, just saw this. It's not just that particular RegEx, I can put in others and still get $1 (literal) instead of the match

Ephellon commented 4 years ago

I'll post more examples when I get home

Ephellon commented 4 years ago

Duplicate of #1110

smtlaissezfaire commented 4 years ago

Is there a way to downgrade this package? This is a show-stopping bug for me.

FYI:

https://gist.github.com/smtlaissezfaire/aea970f853853182afe539b2c505fb0d