Regex Expression - Wireless4024/DiscordBot GitHub Wiki
/regex/ <operator> <words> [replacement]
use to test regex
Name | Description | Parameters | Other name | Example | Result |
---|---|---|---|---|---|
find | get first match | 1 | /\d+/ find a numbers are 1234 and 5678 |
1234 | |
in | get all match | 1 | findall | /\d+/ in a numbers are 1234 and 5678 |
[1234, 5678] |
/\d+/ findall a numbers are 1234 and 5678 |
[1234, 5678] | ||||
match | return true if match else false | 1 | ~ | /\d+/ match i don't have number |
false |
/\d+/ ~ i don't have number |
false | ||||
matchs | return true if full match else false | 1 | ~= | /\d+/ matches i have 123 |
false |
/\d+/ ~= i have 123 |
false | ||||
replace | replace all match with replacement | 2 | = | /\d+/ replace 123 and 456 with 789 number |
number and number with number |
/\d+/ = 123 and 456 with 789 number |
number and number with number | ||||
you can quote a replacement | 2 | /world/ replace hello world !'my dude' |
hello my dude! | ||
replacefirst | replace first match | 2 | /\d+/ replacefirst 123 and 456 with 789 number |
number and 456 with 789 | |
split | split every match | 1 | /\s+/ split split me and me |
[split, me, and, me] | |
if last word is number will used to limit | 2 | /\s+/ split split me and me 2 |
[split, me and me ] | ||
if you don't want to limit just add ' then remove it later |
2 | /\s+/ split split me and me 2' |
[split, me, and, me, 2'] |
Note :
space between regex and operator is optional