[Suggestion] RegExp namespace for ManiaScript

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
Dommy
Translator
Translator
Posts: 1901
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

[Suggestion] RegExp namespace for ManiaScript

Post 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.
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD
User avatar
Nerpson
Translator
Translator
Posts: 1555
Joined: 27 Sep 2013, 18:02
Location: France
Contact:

Re: [Suggestion] RegExp namespace for ManiaScript

Post by Nerpson »

We definitely need this! :thumbsup:
This would help me a lot!
ImageImageImageImage
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 3 guests