preg-match

    1熱度

    2回答

    我正在嘗試創建一個正則表達式來匹配所有字母或空格或具體數字。 這是我的。 ([a-zA-Z\s24]*) #but this is matching a 2 or a 4, i need exactly 24 only ex: - asdfafasf asfasdf #should match asdfafasf asfasdf - asdf asdf asdf 24 #should

    1熱度

    1回答

    驗證的國際電話號碼,我想使用PHP的preg_match()函數以下規則來驗證一個給定的國際電話號碼: - 只允許數字,沒有特殊字符和空格 電話號碼必須與 '00' 總是起始未+ 電話號碼長度應不超過11​​個符號 下 到目前爲止,我有這個,檢查字符串的開頭: preg_match("~^00\d+$~", $_POST['phone']) ,但如果我通過:00014568978945它會接受

    2熱度

    1回答

    我有以下preg_match; preg_match('=^\d?[a-z]{1,2}\d{1,4}[a-z]{1,3}$=i', $mystring); 這很好,但我有一些有/ H或其他字符的mystrings。它們也可能以-1,或-15或其他數字結尾。 Mystrings可以這個樣子W0DLK,WA0DLK,W0DLK-1,W0DLK-20,W0DLK/H,W0DLK/M 如何將添加到現有

    0熱度

    1回答

    工作,我想創建僞簡單例如:瓊/法國/ A3 我知道這是錯,但PLZ糾正我(代碼) if(preg_match('~^[a-zA-Z0-9]{1}+(\/)+([a-zA-Z0-9])?+(\/)+([a-zA-Z0-9])$~',$pseudo)) {echo "god preg";} else {echo"false"}

    0熱度

    1回答

    我想使用preg_match和filter_var來檢查表單條目。我創建了兩個函數,當字段包含無效字符時應該返回false。對於用戶名,無效字符將是數字和符號。我的功能有什麼問題? 用戶名功能: function verifyUsername($x){ if (!preg_match('/[^a-z\s-]/i',$x)) { return 0; } e

    -7熱度

    1回答

    我想在註冊表格中添加一個電話號碼。 用戶需要輸入用戶名,電子郵箱,電話號碼和密碼。所有這些字段都將是必需的,包括電話號碼。 我住在肯尼亞,所以我想限制電話號碼爲13個字符,包括+(符號)。 該號碼應該爲:+25470164XXXX或070164XXXX兩種格式均可接受。 請協助我如何在PHP中使用preg_match函數來實現此功能。 這是我目前正在使用: if (preg_match('/^(\

    1熱度

    1回答

    在我的OCR文字我得到這樣的輸出... "responses": [ { "textAnnotations": [ { "locale": "fr", "description": "3160 6392682B\nrinlraction\nE疊\narlairs&Lei sot les infractions provinsiales, Cour de

    0熱度

    3回答

    我正在嘗試使用正則表達式來獲取包含特定單詞「authenticate(no)」的所有行。我的代碼段是: $pattern = "/^.*\bauthenticate\b.*$/m"; $matches = array(); preg_match($pattern, $text, $matches); var_dump($matches); 輸出: 陣列(1){[0] =>串(54)「c

    0熱度

    3回答

    我想使用preg_replace替換文本。但是我的搜索字符串有一個/所以它使問題。 我該如何解決? $search='r/trtrt'; echo preg_replace('/\b'.addslashes($search).'\b/', 'ERTY', 'TG FRT'); 我越來越error preg_replace(): Unknown modifier 'T'

    1熱度

    1回答

    我從php中獲取了大量HTML中的代碼,代碼是在腳本標記中。我無法有效地使用preg_match在特定行上提取hardest27的值。 所以我目前有一個變量叫做$html,它包含了大量的HTML,它也包含了下面的代碼。 $("<input>").attr({name: "levelReached", value: "hardest27" }).appendTo(newForm); 我怎樣才能得到p