Regex String Manipulator
正則表達式(縮寫為 regex)是指定搜尋模式的字元序列。regex 的常見用途是匹配字串或字串的一部分,以便對結果進行處理。例如,預設表達式 a+ 將返回輸入字串中找到的所有字母 a。因此字串 Cavalry 將輸出 aa,因為單字 Cavalry 中有兩個 a。
Regex - 輸入一個 正則表達式。表達式的匹配結果將由 String Manipulator 返回。有關更多資訊,請參見 Working with Regex。
Capture Group Indices - 當正則表達式包含捕獲組時,確定返回哪些組。值應以逗號 , 分隔(用於清單)或冒號 : 分隔(用於範圍)。有關更多資訊,請參見 Working with Regex。
| 字串 | 正則表達式 | 描述 | 結果 |
|---|---|---|---|
| Hello World. | \s | 移除空格 | HelloWorld. |
| As Capably as Cavalry. | C.....y | 以 C 開頭、以 y 結尾的 7 個字母的單字 | CapablyCavalry |
| Is it Colour or Color? | Colou?r | Colour 或 Color | ColourColor |
| 3 is the magic number. | \d | 任意數字 | 3 |