I have currently received
preg_replace('/[^0-9]/s', '', $myvariable);
For example, entering GB -3. My current line gives me a value of 3. I want to be able to save the minus so that the value shows -3 instead of the current output of 3.
try the following:
preg_replace('/[^\d-]+/', '', $myvariable);
regex breakdown:
//
[]
^
\d
-
+
Source: https://habr.com/ru/post/922534/More articles:Should functions like this test units of measure? - phpWhy does cout print twice when I use getline? - c ++What is an abstract syntax tree / is it needed? - language-agnosticWhy not std :: getline block? - c ++Any web environment and Java IDE for ARM architecture on Linux? - javaUsing Knockout Bindings in Actionlink MVC - data-bindingConvert Torrent info_hash from bencoded to URLEncoded data - httpError Paypal MPL iOS - iosHow to read all articles from an RSS feed? - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/922539/how-to-clone-cvs-repository-with-empty-directories&usg=ALkJrhiMsW9fXTy82q-iqyoHA_4n7IedugAll Articles