diffplug / diffplug/spotless

maven replace regex replacement leading whitespace

Open
#2,683 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 13h
Merged PRs (30d)
34

Description

I'm doing some replaceRegex rules and I'm attempting to replace some text with `` { }`` however the leading whitespace gets trimmed and doesn't get added.

I've tried numerous work arounds using unicode, cdata, escape codes, and they all get trimmed (or the formatter just breaks)

How the heck do i add a leading space in the replacement text?

```xml

collapseEmptyBlocks
(?s)[\s\r\n]*\{[\s\r\n]*\}
{}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.