Type none Guide
Summary A reference for common regex operators and some example feeds.
First version
Regex can be used for feeds and triggers in the webclient in order to pick up anything that matches a certain pattern when you don't know what the exact text will be.
Below are a few examples of common regex patterns used by Underspire players, as well as a short, non-exhaustive reference of common operators and what they mean.
# Patterns
`/^(\^.{6}|@.{1,12}|NOUS) (>>|<<)/`
This will pick up any messages over public NOUS chat so you can put them in a separate feed.
`/^\[\w{3} \d{2} \d{2}:\d{2}\]/`
This will pick up any texts or voicemails sent or received via your handset. Also picks up the other side of a voice call, but not your own side, as that follows a different format.
# Operators
`.`: Matches to any character.
`*`: Matches to any number of instances of the previous character, rather than just one. `.*` is a common wildcard in case you don't know what or if text will be in a certain place in your pattern.
`+`: Matches to one or more instances of the previous character. `.+` is another common wildcard, used if you know there will be text in a certain place but not what it will be.
`^`: Matches to the start of a line. In Underspire, this will also match to the start of speech.
`$`: Matches to the end of a line. In Underspire, this will also match to the end of speech.
`|` within parantheses: Matches to either string in the parantheses separated by |, without needing both.
`\`: An escape character that allows you to use operators as characters to match to rather than for their functions. Ex: `\^` will match to occurrences of ^ rather than to the start of line. `\\` will match to \\.
Also used for character sets as shown below.
`\w`: Matches to any letter, upper or lowercase.
`\d`: Matches to any digit 0-9.
`{X}`: Match X number of occurrences of the previous character, e.g. `a{3}` will match `aaa`. This can be used in combination with character sets, such as `\w{3}` matching any three letters in a row. Can be used in the format `{X,Y}` to pick up any number of instances from X to Y. `\w{2,4}` will match one, two, or three letters in a row, but not only one.
Line by line
…
+ Regex can be used for feeds and triggers in the webclient in order to pick up anything that matches a certain pattern when you don't know what the exact text will be.
+
+ Below are a few examples of common regex patterns used by Underspire players, as well as a short, non-exhaustive reference of common operators and what they mean.
+
+ # Patterns
+
+ `/^(\^.{6}|@.{1,12}|NOUS) (>>|<<)/`
+
+ This will pick up any messages over public NOUS chat so you can put them in a separate feed.
+
+ `/^\[\w{3} \d{2} \d{2}:\d{2}\]/`
+
+ This will pick up any texts or voicemails sent or received via your handset. Also picks up the other side of a voice call, but not your own side, as that follows a different format.
+
+ # Operators
+
+ `.`: Matches to any character.
+
+ `*`: Matches to any number of instances of the previous character, rather than just one. `.*` is a common wildcard in case you don't know what or if text will be in a certain place in your pattern.
+
+ `+`: Matches to one or more instances of the previous character. `.+` is another common wildcard, used if you know there will be text in a certain place but not what it will be.
+
+ `^`: Matches to the start of a line. In Underspire, this will also match to the start of speech.
+
+ `$`: Matches to the end of a line. In Underspire, this will also match to the end of speech.
+
+ `|` within parantheses: Matches to either string in the parantheses separated by |, without needing both.
+
+ `\`: An escape character that allows you to use operators as characters to match to rather than for their functions. Ex: `\^` will match to occurrences of ^ rather than to the start of line. `\\` will match to \\.
+ Also used for character sets as shown below.
+
+ `\w`: Matches to any letter, upper or lowercase.
+
+ `\d`: Matches to any digit 0-9.
+
+ `{X}`: Match X number of occurrences of the previous character, e.g. `a{3}` will match `aaa`. This can be used in combination with character sets, such as `\w{3}` matching any three letters in a row. Can be used in the format `{X,Y}` to pick up any number of instances from X to Y. `\w{2,4}` will match one, two, or three letters in a row, but not only one.