Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
(?<prefix>(?:^|^[\s\n\t\r]+)\/(?:[\s\n\t\r]*)|(?<=[\s\n\t\r])\.:(?:[\s\n\t\r]*)|(?<=[\s\n\t\r])::(?:[\s\n\t\r]*))(?<command>[a-zA-Z0-9]+)(?:[\s\n\t\r]*)(?<arguments>[^]*?(?=(?<=[\s\n\t\r])\.:|(?<=[\s\n\t\r])::|$))
/
g

Description

Example: "/lowercase HELLO .:uppercase ::weather london"

===Match #1 prefix: / command: lowercase arguments: HELLO ===Match #2 prefix: .: command: uppercase arguments: - ===Match #3 prefix: :: command: weather arguments: london

Submitted by CietstHydroxide - 4 years ago