Page 1 of 1

[Suggestion] RegExp namespace for ManiaScript

Posted: 28 Feb 2018, 16:45
by Dommy
A lot of creators would really appreciate if ManiaScript had a regular expressions namespace with some basic methods, like Match and Replace. A RegExp literal would be welcome, too.

Example:

Code: Select all

// Methods
Text[Void] Match(Text Source, Text Pattern, Text Flags)
Text Replace(Text Source, Text Pattern, Text Flags, Text Replacement)

// Match
declare Message = "Some sort of :flags system is :now possible.";
declare FoundStuff = RegExp::Match(Message, ":.+", "g");
log(FoundStuff); // [":flags", ":now"]

// Replace
declare Message = "Have you seen my $l[malicious.site]new map$l?"
declare LinkRemoved = RegExp::Replace(Message, "\$[lL]\[.+\]", "g", "");
log(LinkRemoved); // "Have you seen my new map?"
PS. An Integer of occurences would be appreciated for TextLib::Find() method, too.

Re: [Suggestion] RegExp namespace for ManiaScript

Posted: 25 Jul 2018, 20:08
by Nerpson
We definitely need this! :thumbsup:
This would help me a lot!