mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-16 20:20:57 +01:00
re-organized pattern matching code
This commit is contained in:
@@ -186,14 +186,15 @@ func (c *Config) ApplyDefaults() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Config) PreparePattern() error {
|
||||
PatternR, err := regexp.Compile(c.Pattern)
|
||||
func (c *Config) PreparePattern(pattern string) error {
|
||||
PatternR, err := regexp.Compile(pattern)
|
||||
|
||||
if err != nil {
|
||||
return errors.Unwrap(fmt.Errorf("Regexp pattern %s is invalid: %w", c.Pattern, err))
|
||||
}
|
||||
|
||||
c.PatternR = PatternR
|
||||
c.Pattern = pattern
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user