Add search with regex support.
search_regex =
default: none
Regex to search for the string to be replaced in the file.
Support {current_version} template string (e.g. (?<=version='){current_version}(?=')).
If search_regex is defined, the search template string will be ignored in the section.
[bumpversion]
current_version = 2.4.5
[bumpversion:file:pom.xml]
search_regex = (?<=test-app-java</artifactId>\n\s{4}<version>){current_version}(?=</version>)
search = <version>{current_version}</version> ; will be ignored
replace = {new_version}
Example of use, when the application version is the same as some dependencies (java application, pom.xml):
...
<artifactId>test-app-java</artifactId>
<version>2.4.5</version>
<packaging>jar</packaging>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.4.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.5</version>
</plugin>
</plugins>
</pluginManagement>
...
Also available as --search-regex
Hi @alexgracianoarj, could I help you in somehow with this? maybe we can add some description to make it more clear?
Hi,
The example in the README (MyProject==) does not make clear why you would use this instead of regular search.
Could you elaborate a bit (in this issue) what you are using this for?
Hi @eduzen and @florisla, i have update the README file and description.