简化**替换正则
This commit is contained in:
+1
-4
@@ -74,10 +74,7 @@ fn match_path_with_regex(real_path string, reg_path string) (bool, regex.RE) {
|
|||||||
start := time.now()
|
start := time.now()
|
||||||
mut one_more_star_reg := regex.regex_opt(r'\*{2,}') or { panic(err) }
|
mut one_more_star_reg := regex.regex_opt(r'\*{2,}') or { panic(err) }
|
||||||
repl_on_e_more_star_fn := fn (re regex.RE, in_txt string, start int, end int) string {
|
repl_on_e_more_star_fn := fn (re regex.RE, in_txt string, start int, end int) string {
|
||||||
if in_txt.ends_with('*') {
|
return r'[^#\?]+'
|
||||||
return r'([^#\?]/){0,}[^#\?]+'
|
|
||||||
}
|
|
||||||
return r'([^#\?]+//){0,}[^#\?]+'
|
|
||||||
}
|
}
|
||||||
mut replaced_reg_path := reg_path.replace('?', r'\?')
|
mut replaced_reg_path := reg_path.replace('?', r'\?')
|
||||||
replaced_reg_path = replaced_reg_path.replace('+', r'\+')
|
replaced_reg_path = replaced_reg_path.replace('+', r'\+')
|
||||||
|
|||||||
Reference in New Issue
Block a user