Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正規表現を使用してテキストボックスのテキストを検証しています。形式はx.xxxx現在使用して@"\d{1}.\d{1,4}"いますが、許可するように式を変更したいのでx、押すと、.を検証する必要があり\d{1,4}ます。
x.xxxx
@"\d{1}.\d{1,4}"
x
.
\d{1,4}
JavaScriptでは、を使用してそれを行い /^\d(\.\d{1,4})?$/ます。C#ではあなたはそれをします@"^\d(\.\d{1,4})?$"
/^\d(\.\d{1,4})?$/
@"^\d(\.\d{1,4})?$"
これを試してみてください
// Optional deciaml points var regexp = /^\d+(\.\d{1,4})?$/; regexp.test('13.5454')
これにより、小数点以下4桁まで使用できます。ただし、小数点以下の桁数はオプションです