Difference between revisions of "Guide to Regex"

From Paradise Station Wiki
Jump to navigation Jump to search
m (Wrong link)
(Adds some examples and a testing tool for people to use)
Line 1: Line 1:
This page is under construction. Please view the [http://www.byond.com/docs/ref/#/{notes}/regex BYOND Regex reference] in the meantime.
 
 
== Introduction ==
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 ingame.
 
A helpful tool in testing your regex string is [https://regex101.com/ this site here].
 
== Info ==
This part is under construction. Please view the [http://www.byond.com/docs/ref/#/{notes}/regex BYOND Regex reference] in the meantime.
 
== Examples ==
 
{| class="wikitable" style="text-align: center;"
|- style="font-weight: bold; text-align: center; background-color: chocolate; color: white;"
| style="width: 250pt; center;"            | Description
| style="width: 150pt; center;"            | Regex syntax
| style="width: 150pt; center;"            | Example regex
| style="width: 150pt; center;"            | Example output
|-
! Select a multiple of sub texts that start with the given text
| \bword1<nowiki>|</nowiki>\bword2
| \bhello<nowiki>|</nowiki>\bworld
| <mark>hello</mark> beautiful <mark>world</mark>s! hhello
|-
! Select a multiple of sub texts that have to fully match the given text
| \bword1\b<nowiki>|</nowiki>\bword2\b
| \bhello\b<nowiki>|</nowiki>\bworld\b
| <mark>hello</mark> beautiful worlds! hhello
|-
! Select a word with an aritrary (non zero) amount of characters in one spot
| word+
| ca+ptain
| <mark>Caaaaaaaaaaaptain</mark>! <mark>captain</mark> nukies onboard!
[[Category:Guides]]
|}

Revision as of 11:42, 15 December 2020


Introduction

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 ingame.

A helpful tool in testing your regex string is this site here.

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 \bword1|\bword2 \bhello|\bworld hello beautiful worlds! hhello
Select a multiple of sub texts that have to fully match the given text \bword1\b|\bword2\b \bhello\b|\bworld\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!