regex

    0熱度

    1回答

    在這裏htaccess的重寫規則是我的網址: example.com/profile.php?username=name.name 或 例子.COM/profile.php?用戶名=名稱 我想重寫它這樣 example.com/name 或 example.com/name.name 這裏是我的.htaccess代碼 RewriteEngine on ErrorDocument 404 /404

    0熱度

    1回答

    我怎麼能匹配,除非它們包含一個點的所有單詞的每一個字,像 我想 except.this 等類似的詞語用點匹配一切都在他們 我試過\b(?!\w+\.\w+)\w+\b但這沒有奏效。 不管我如何使用\w+,\\.等解釋仍然符合部分「忽略。我」點後面。它有一個簡單的語法嗎?只是逃避這一點似乎並不奏效。

    1熱度

    2回答

    我期待與多個字母大寫單詞的第一個實例後,細胞分裂。 實施例1: 輸入1:樓層4 InformatiqueNoosavilleSep 希望的輸出1:NoosavilleSep 圖樣:的應該分裂中的最後一個字出現在大寫的第二實例。 「InformatiqueNoosavilleSep」 實施例2: 輸入:樓層13個InformatiqueSurfers ParadiseSep 輸出:衝浪者Paradi

    -1熱度

    1回答

    我有一個表格,其中包含顯示chair.jpg sofa.gif等的單元格...我試圖用以下代碼替換具有圖像src的文本 var isImgUrl= /.*?\.(?:png|jpg|jpeg|gif)/ig; var txt=document.getElementById('comment'); txt.innerHTML=txt.innerHTML.replace(isImgUrl,'<im

    0熱度

    1回答

    我有幾個包含像在許多不同的線以下的文本文件: this_is_THIS.doc 我需要做到的是,以取代本前5次出現不同的物體,並忽略其餘的物體。 我想它出現類似如下: this_is_TREE.doc this_is_CAR.doc this_is_CAT.doc this_is_DONKEY.doc this_is_ROCK.doc 我將在未來的話改變,所以我覺得一個正則表達式,

    0熱度

    1回答

    我有以下的輸入字符串 "/horses/[email protected]" "/Goats/[email protected]" "/CATS/[email protected]" 我想獲得 "horses", "c132", "[email protected]" "Goats", "b-01", "[email protected]" "CATS", "001", "[email

    0熱度

    1回答

    可變source包含IP地址的,我試圖在陣列ips得到,但不順心的事,我無法找到錯誤... var ips = source.match(/((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A

    0熱度

    1回答

    我正在使用正則表達式來解析nginx日誌。 我創建的一個領域是'消息'。有時這個組將包含一個JSON字符串。 如何在我的'消息'組中選擇匹配以創建'json'組? 這裏是我當前的正則表達式: (?<time>\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}) \[(?<log_level>\w+)\] (?<pid>\d+).(?<tid>\d+): (?<message

    0熱度

    1回答

    我很難得到永久重定向工作。我希望使用正則表達式來實現這一點。 舊的URL:https://example.com/olddir/other_name_here/123456/garbage.jpg 新的URL:https://example.com/newdir/other-name-here-123456/ 注意從下劃線的變化,以破折號和我的數字串後扔額外位了一個事實。我試過這個,但它不工作(頁

    0熱度

    1回答

    有數組中的一些對象是這樣的: const result = [ { "_id": "Dn59y87PGhkJXpaiZ", "title": "Something", "synonyms": [ "Anything", "else" ] }, { ... } ] 我通過執行該得到這樣的結果: Content.find({