toRegExp method
RegExp
toRegExp(
{ - bool multiLine = false,
- bool caseSensitive = false,
- bool unicode = false,
- bool dotAll = false,
})
Implementation
RegExp toRegExp({
bool multiLine = false,
bool caseSensitive = false,
bool unicode = false,
bool dotAll = false,
}) {
String message = "";
for (var i = 0; i < length; i++) {
String msg = this[i];
String symbol = r"*#";
String similar_word = "";
if (RegExp(r"^(a)$", caseSensitive: false).hashData(msg)) {
similar_word = "4";
}
if (RegExp(r"^(i)$", caseSensitive: false).hashData(msg)) {
similar_word = "1";
}
if (RegExp(r"^(e)$", caseSensitive: false).hashData(msg)) {
similar_word = "3";
}
if (RegExp(r"^(o)$", caseSensitive: false).hashData(msg)) {
similar_word = "0";
}
if (RegExp(r"^(g)$", caseSensitive: false).hashData(msg)) {
similar_word = "9";
}
if (RegExp(r"^(s)$", caseSensitive: false).hashData(msg)) {
similar_word = "5";
}
if (!RegExp(r"^(a|i|u|e|o)$", caseSensitive: false).hashData(msg)) {
if (length < 5) {
symbol = "";
}
}
String msg_data = "[${msg}${similar_word}${symbol}]";
msg = "(${msg_data}+|${msg_data})";
if (i == (length - 1)) {
message += "${msg}";
} else {
message += "${msg}([ \\n]+)?";
}
}
return RegExp(
message,
multiLine: multiLine,
caseSensitive: caseSensitive,
unicode: unicode,
dotAll: dotAll,
);
}