Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns containing any of '^', '$', '<', '>' do not match #98

Open
GoogleCodeExporter opened this issue May 6, 2015 · 4 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Specify regex pattern containing any of '^', '$', '<', '>'

What is the expected output? What do you see instead?

Pattern "^.*$" should match every input line but matches no line.
Pattern "<build>" should match input "<build>" but matches nothing.

What version of the product are you using?

1.5.3

Please provide any additional information below.

There is no match regardless of whether the pattern is wrapped in a CDATA block 
or the '>' and '<' are written in escaped form.

OS: OSX
Java: 7 update 67
Maven: 3.2.1

Original issue reported on code.google.com by [email protected] on 12 Oct 2014 at 2:22

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Can you post all the configuration?

Also, make sure to use: <regex>true</regex> when using a token containing regex 
for matching.

Original comment by [email protected] on 13 Oct 2014 at 1:31

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

I have downgraded to 1.5.2 and relative paths do work in that version.

The configuration I use is as follows. For testing I added the pattern "^.*$" 
with an empty string as replacement value, which I think should yield a file 
with empty lines. But it does not. The other patterns match, yielding some 
empty lines in the output file.

<plugin>
    <groupId>com.google.code.maven-replacer-plugin</groupId>
    <artifactId>replacer</artifactId>
    <version>1.5.2</version>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>replace</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <file>target/feature/feature.xml</file>
        <regex>true</regex>
        <replacements>
            <replacement>
                <token>^.*$</token>
                <value></value>
            </replacement>
            <replacement>
                <!-- For whatever reason, the plugin refuses to match '<', '>', '^', and '$'. CDATA section or not. -->
                <token>.*titan-.*/${titan.version}./bundle.</token>
                <value></value>
            </replacement>
            <replacement>
                <!-- For whatever reason, the plugin refuses to match '<', '>', '^', and '$'. CDATA section or not. -->
                <token>.*camel-uldap.*/${project.version}./bundle.</token>
                <value></value>
            </replacement>
        </replacements>
    </configuration>
</plugin>

Original comment by [email protected] on 14 Oct 2014 at 2:54

@GoogleCodeExporter
Copy link
Author

I have exactly the same problem.

I want to remove all spaces at each line before a tag with the following 
configuration:

            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <basedir>${project.build.directory}</basedir>
                    <filesToInclude>${project.build.finalName}/WEB-INF/views/**/*.jsp</filesToInclude>
                    <token>>\s*<</token>
                    <value>><</value>
                    <regex>true</regex>
                    <regexFlags>
                        <regexFlag>MULTILINE</regexFlag>
                    </regexFlags>
                </configuration>
            </plugin>

Doesn't work...so it's exactly the same...

Original comment by [email protected] on 16 Mar 2015 at 2:09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant