You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/07/10 02:10:52 UTC

[incubator-doris] branch master updated: [refactor] Make Regex more simple and clear (#6141)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 814840f  [refactor] Make Regex more simple and clear (#6141)
814840f is described below

commit 814840f8267bba94376ab48df4974b1c7ce615ec
Author: Arthur.Zhang <zh...@qq.com>
AuthorDate: Sat Jul 10 10:10:41 2021 +0800

    [refactor] Make Regex more simple and clear (#6141)
    
    1. Remove Redundant character escape ‘\\}’ and ‘\\:’
    2. Replace ‘{0,1}’ to ‘?’
---
 fe/fe-core/src/main/java/org/apache/doris/common/ConfigBase.java     | 2 +-
 fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/ConfigBase.java b/fe/fe-core/src/main/java/org/apache/doris/common/ConfigBase.java
index dc16cf2..1011ead 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/ConfigBase.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/ConfigBase.java
@@ -120,7 +120,7 @@ public class ConfigBase {
     // the "CONFIG_VALUE" should be replaced be env variable CONFIG_VALUE
     private void replacedByEnv(Properties props) throws Exception {
         // pattern to match string like "{CONFIG_VALUE}"
-        Pattern pattern = Pattern.compile("\\$\\{([^\\}]*)\\}");
+        Pattern pattern = Pattern.compile("\\$\\{([^}]*)\\}");
         for (String key : props.stringPropertyNames()) {
             String value = props.getProperty(key);
             Matcher m = pattern.matcher(value);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java
index 4feded8..11fee36 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java
@@ -73,7 +73,7 @@ public class TimeUtils {
                     + "((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))"
                     + "(\\s(((0?[0-9])|([1][0-9])|([2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$");
     
-    private static final Pattern TIMEZONE_OFFSET_FORMAT_REG = Pattern.compile("^[+-]{0,1}\\d{1,2}\\:\\d{2}$");
+    private static final Pattern TIMEZONE_OFFSET_FORMAT_REG = Pattern.compile("^[+-]?\\d{1,2}:\\d{2}$");
 
     public static Date MIN_DATE = null;
     public static Date MAX_DATE = null;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org