Skip to content

Commit 559c178

Browse files
committed
Simplify regex expressions
1 parent 09815cc commit 559c178

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public enum DurationStyle {
3636
/**
3737
* Simple formatting, for example '1s'.
3838
*/
39-
SIMPLE("^([\\+\\-]?\\d+)([a-zA-Z]{0,2})$") {
39+
SIMPLE("^([+-]?\\d+)([a-zA-Z]{0,2})$") {
4040

4141
@Override
4242
public Duration parse(String value, ChronoUnit unit) {
@@ -62,7 +62,7 @@ public String print(Duration value, ChronoUnit unit) {
6262
/**
6363
* ISO-8601 formatting.
6464
*/
65-
ISO8601("^[\\+\\-]?P.*$") {
65+
ISO8601("^[+-]?P.*$") {
6666

6767
@Override
6868
public Duration parse(String value, ChronoUnit unit) {

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private void append(StringBuilder result, Period value, Unit unit) {
102102
/**
103103
* ISO-8601 formatting.
104104
*/
105-
ISO8601("^[\\+\\-]?P.*$", 0) {
105+
ISO8601("^[+-]?P.*$", 0) {
106106

107107
@Override
108108
public Period parse(String value, ChronoUnit unit) {

0 commit comments

Comments
 (0)