bhughes339 / vscode-replacerules

Search/replace rule support for Visual Studio Code
GNU General Public License v3.0
41 stars 13 forks source link

WrapHtmlAttributes #32

Closed szotyi41 closed 3 years ago

szotyi41 commented 4 years ago

I wrote a regex for search every space in html tags between attributes except the first. If I open vscode-s find and replace bar, options show in the code, but if i connect this rule with a shortcut its not working. If the regex is different its working. Its not working becouse of the " signs, thats why i put \ before of that. But its not working.

The question is:

How can I use " signs in regex?

Original regex, what is working:

(?<![A-Z0-9-])[ ]+(?=[A-Z-:@]{0,}((="[^"]{0,}")|>))

Code:

    "replacerules.rules": {
        "WrapHtmlAttributes": {
            "find": "(?<![A-Z0-9-])[ ]+(?=[A-Z-:@]{0,}((=\"[^\"]{0,}\")|>))",
            "replace": "\n    ",
            "flags": "g"
        }
    }
bhughes339 commented 4 years ago

Can you give an example of some text that is successfully replaced with the original regex?

bhughes339 commented 3 years ago

Closing due to inactivity. Let me know if you're still having issues.