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.
SQL データベースに正規表現があります
例: ^[AZ Ñ\s\.\,\\"\%]+$
次に、SQL Readerで取得します
sql.Reader["Regular_Expression"].ToString()
しかし、それは次を返します: "^[AZ Ñ\\s\\.\\,\\\\"\\%]+$"
@ を使用する場合のように、.ToString() 関数を使用して文字列を変更しないようにする方法は誰でも知っています。
それを解決するには、Regex ライブラリの Regex.Unescape() 関数を使用する必要があります。
この問題は、オブジェクトから文字列への不適切なキャストが原因で発生します。