mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-23 14:40:34 +01:00
Fixed regex matching in GUIValidators
This commit is contained in:
parent
a623810518
commit
b9ec691dcd
1 changed files with 4 additions and 8 deletions
|
@ -10,8 +10,8 @@ import scala.util.matching.Regex
|
|||
object GUIValidators {
|
||||
val hostRegex = """([a-fA-F0-9]+)@([a-zA-Z0-9\.\-_]+):([0-9]+)""".r
|
||||
val amountRegex = """\d+""".r
|
||||
val amountDecRegex = """\d+|\d+\.[\d]{1,3}""".r // accepts 3 decimals at most
|
||||
val paymentRequestRegex = """[a-zA-Z0-9]+:[a-zA-Z0-9]+:[a-zA-Z0-9]+""".r
|
||||
val amountDecRegex = """(\d+)|(\d+\.[\d]{1,3})""".r // accepts 3 decimals at most
|
||||
val paymentRequestRegex = """([a-zA-Z0-9]+):([a-zA-Z0-9]+):([a-zA-Z0-9]+)""".r
|
||||
val hexRegex = """[0-9a-fA-F]+""".r
|
||||
|
||||
/**
|
||||
|
@ -26,12 +26,8 @@ object GUIValidators {
|
|||
*/
|
||||
def validate(field: String, validatorLabel: Label, validatorMessage: String, regex: Regex): Boolean = {
|
||||
return field match {
|
||||
case regex() => {
|
||||
return validate(validatorLabel, validatorMessage, true)
|
||||
}
|
||||
case _ => {
|
||||
return validate(validatorLabel, validatorMessage, false)
|
||||
}
|
||||
case regex(_*) => validate(validatorLabel, validatorMessage, true)
|
||||
case _ => validate(validatorLabel, validatorMessage, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue