Skip to content

maven replace regex replacement leading whitespace #2683

@QarthO

Description

@QarthO

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?

 <replaceRegex>
    <name>collapseEmptyBlocks</name>
    <searchRegex>(?s)[\s\r\n]*\{[\s\r\n]*\}</searchRegex>
    <replacement> {}</replacement> <!-- why spotless remove the leading whitespace???  -->
</replaceRegex>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions