Difference between revisions of "Guide to Regex"
Jump to navigation
Jump to search
This page/section is a stub You can help by expanding it
(Adds some examples and a testing tool for people to use) |
Sirryan2002 (talk | contribs) m (uneccesary introduction heading) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Regex is a way to search a subtext within a text. It will allow you to search more complex things and will give you more freedom on what to highlight. It however is a bit complex to fully understand in one go. See the [[#Examples|Examples]] for some easy to use regex strings. | Regex is a way to search a subtext within a text. It will allow you to search more complex things and will give you more freedom on what to highlight. It however is a bit complex to fully understand in one go. See the [[#Examples|Examples]] for some easy to use regex strings. | ||
The regex will be case insensitive by default | The regex will be case insensitive by default in game. | ||
A helpful tool in testing your regex string is [https://regex101.com/ this site here]. | A helpful tool in testing your regex string is [https://regex101.com/ this site here]. | ||
==How to enable Regex in the chat window== | |||
*Click the Options Gear in the chat window. | |||
[[File:Highlightstring.png|300px]] | |||
*Click highlight string. | |||
[[File:Highlightstring2.png]] | |||
*Enter the words you want to be highlighted. | |||
[[File:Highlightstring3.png]] | |||
*Words are now highlighted. | |||
[[File:Highlightstring5.png|500px]] | |||
*Check enable regex. | |||
[[File:Highlightstring4.png]] | |||
== Info == | == Info == | ||
Line 20: | Line 29: | ||
|- | |- | ||
! Select a multiple of sub texts that start with the given text | ! Select a multiple of sub texts that start with the given text | ||
| \ | | \b(word1<nowiki>|</nowiki>word2) | ||
| \ | | \b(hello<nowiki>|</nowiki>world) | ||
| <mark>hello</mark> beautiful <mark>world</mark>s! hhello | | <mark>hello</mark> beautiful <mark>world</mark>s! hhello | ||
|- | |- | ||
! Select a multiple of sub texts that have to fully match the given text | ! Select a multiple of sub texts that have to fully match the given text | ||
| | | \b(word1<nowiki>|</nowiki>word2)\b | ||
| | | \b(hello<nowiki>|</nowiki>world)\b | ||
| <mark>hello</mark> beautiful worlds! hhello | | <mark>hello</mark> beautiful worlds! hhello | ||
|- | |- | ||
Line 35: | Line 44: | ||
[[Category:Guides]] | [[Category:Guides]] | ||
|} | |} | ||
{{Stub}} |
Latest revision as of 01:09, 9 June 2021
Regex is a way to search a subtext within a text. It will allow you to search more complex things and will give you more freedom on what to highlight. It however is a bit complex to fully understand in one go. See the Examples for some easy to use regex strings. The regex will be case insensitive by default in game.
A helpful tool in testing your regex string is this site here.
How to enable Regex in the chat window
- Click the Options Gear in the chat window.
- Click highlight string.
- Enter the words you want to be highlighted.
- Words are now highlighted.
- Check enable regex.
Info
This part is under construction. Please view the BYOND Regex reference in the meantime.
Examples
Description | Regex syntax | Example regex | Example output |
Select a multiple of sub texts that start with the given text | \b(word1|word2) | \b(hello|world) | hello beautiful worlds! hhello |
---|---|---|---|
Select a multiple of sub texts that have to fully match the given text | \b(word1|word2)\b | \b(hello|world)\b | hello beautiful worlds! hhello |
Select a word with an aritrary (non zero) amount of characters in one spot | word+ | ca+ptain | Caaaaaaaaaaaptain! captain nukies onboard! |