You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: weight.go
    path of file: ./repos/Xray-core/app/router
    
    the code of the file until where you have to start completion: package router

import (
	"regexp"
	"strconv"
	"strings"
	"sync"
)

type weightScaler func(value, weight float64) float64

var numberFin
    
func (s *WeightManager) findValue(tag string) float64 {
	for _, w := range s.settings {
		matched := s.getMatch(tag, w.Match, w.Regexp)
		if matched == "" {
			continue
		}
		if w.Value > 0 {
			return float64(w.Value)
		}
		// auto weight from matched
		numStr := numberFinder.FindString(matched)
		if numStr == "" {
			return s.defaultWeight
		}
		weight, err := strconv.ParseFloat(numStr, 64)
		if err != nil {
			newError("unexpected error from ParseFloat: ", err).AtError().WriteToLog()
			return s.defaultWeight
		}
		return weight
	}
	return s.defaultWeight
}