NEW Remove the /m flags from String->match, replace regex, is match regex and friends - while this is backward-imcompatible, the flag severly limits functionality and can lead to security issues when used for input validation

This commit is contained in:
Michal Moskal 2015-07-26 13:57:27 -07:00
Родитель b350a55d9c
Коммит e548149a18
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -171,7 +171,7 @@ module TDev.RT {
//? Indicates if the string matches a regular expression
export function is_match_regex(self: string, pattern: string): boolean
{
var rx = new RegExp(pattern, "gm");
var rx = new RegExp(pattern, "");
return rx.test(self);
}
@ -183,7 +183,7 @@ module TDev.RT {
export function match(self: string, pattern: string): Collection<string>
{
try {
var rx = new RegExp(pattern, "m");
var rx = new RegExp(pattern, "");
var r = rx.exec(self);
if (!r)
return Collections.create_string_collection();
@ -199,7 +199,7 @@ module TDev.RT {
export function matches(self: string, pattern: string): Collection<string>
{
try {
var rx = new RegExp(pattern, "gm");
var rx = new RegExp(pattern, "g");
var r = self.match(rx);
return Collection.mkStrings(r || []);
}
@ -225,7 +225,7 @@ module TDev.RT {
{
try
{
var rx = new RegExp(pattern, "gm");
var rx = new RegExp(pattern, "g");
return self.replace(rx, replace);
}
catch (e)
@ -240,7 +240,7 @@ module TDev.RT {
{
try
{
var rx = new RegExp(pattern, "gm");
var rx = new RegExp(pattern, "g");
}
catch (e)
{