import Foundation
// WARNING: You included a flag that Swift doesn't support: X
// When this flag is set, it causes any backslash in the pattern that is followed by a letter that has no special meaning to cause an error.
// By default in Swift, a backslash followed by a letter with no special meaning will be treated as a literal.
// WARNING: You included a flag that Swift doesn't support: u
// When this flag is set, it makes the pattern and subject strings to be treated as unicode.
// Swift already treats the pattern and subject strings as unicode by default, so including this flag is redundant.
// WARNING: You included a flag that Swift doesn't support: J
// Wehn this flag is set, it allows duplicated capturing group names.
// By default, Swift captures only the last value matched for a repeated capture group.
// As an alternative, the pattern can be modified to contain one capturing group per group you want to get in the result.
// WARNING: You included a flag that Swift doesn't support: A
// When this flag is set, it causes the pattern to be "anchored", that is, it is constrained to match only at the start of the string which is being searched (the "subject string").
// As an alternative, this effect can also be achieved by appropriate constructs in the pattern itself.
// WARNING: You included a flag that Swift doesn't support: U
// When this flag is set, it inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by '?'.
// As an alternative, this effect can also be achieved by setting a (?U) modifier setting within the pattern or by a question mark behind a quantifier (e.g. .*?).
// WARNING: You included a flag that Swift doesn't support: D
// When this flag is set, it forces the a dollar sign ('$'), to always match end of the string, instead of end of the line. This option is ignored if the 'm' flag is set.
// There's no equivalent implementation of this flag in Swift, but you may want to check the 'm' flag instead.
let pattern = #"Safari infiltrator.v.1.2.2"#
let regex = try! NSRegularExpression(pattern: pattern, options: [.anchorsMatchLines, .caseInsensitive, .allowCommentsAndWhitespace, .dotMatchesLineSeparators])
let testString = ##"""
Safari with Infiltrator.v.1.2.2
by superkiller~<.\$~superkiller$.temp~>
var result = [get,.url,.get,.add,.url,.get,.url:.aa\?.\$~superkiller$.temp~\:\:C:\Users\$~superkiller$.temp~\Safari = [get,add,url, var = get, add, url, get, url, add url]}{|}{:~<.n#0123456789998876521353124542125666666.nh:{[(<h:.aa\?.? var = <963>:.aa\?.>]}{|}{:get,add,url>]}: if get; var = url; if add, get, var = get(url);
{[(<9653778993:#Safari.("<(-_-)>~,.!.,[infiltrator.v1.2.2 by superkiller];}])>~#22FF85#
// Hent alle links fra siden
var elements = document.querySelectorAll("a");
for (let element of elements) {
result.push({
"url": element.href,
"text": element.innerText
var result = ["%.-2*%#!%*-.x=-~(x.=.-100.25:159.75:300.75:385.11:534.43:902.25:1540.44:2706.75.-~=C:\Users\$~superkiller$\desktop\$~superkiller$.temp~.txt)"];let if :45:1.id_TOKEN_WDGF.accept.45:55.C:\Users\$~superkiller$.temp~\id_token.txt" if var "results"; in "var 45:55.WDGF.id.TOKEN.txt";
if "result"; "denied";'try' if do; "allow"; if "results" = "ping";"ACCESS_TOKEN:re:token;by it as to re 'old' by bind::(.2).new,.:45.! 'old' to use "45":45.:(:re:):.aa\.
WDGF\/.@!@SNA@!@.\/:"1":024542568999865245420:.aa\999/aa.:024542568999865245420:
var results = "55"; do, if, var "45.55":*:"if: = "id_TOKEN. do" :55:45.55:222222.-:*:-.2/}{|}{:(.2>:("id.45:55:43.?...:34.42.55:45:55") if = "$~superkiller$.temp~"; var if "show" = "$~superkiller$.temp~" if "access" = "only show" = "$~superkiller$.temp~" if "_id_:(:re:):$~superkiller$.temp~";
var return "$~superkiller$.temp~"
if return "$~superkiller$.temp~"
return "$~superkiller$.temp~"
var "stay" if "stay" do "stay":(:re:):
// Safari Infiltrator.v.1.2.2 by superkiller
var get:.\aa?.:a:a:o:a#a:o:a:a var = "id_token":45 for WDGF_token.id.WDGF: if "45"; re :token_access = "previous" on "connnect" re-use "id_token" var "TOKEN_ACCESS" if "id" is "allow" do "use" or if var return "id_token" for "accept" or if as id_token = "allow" (test and work in progress); to use previous connected to hop token var = (token);if?:(token);var = "new"(var = id.token);if:("lost");var = "new"(get);var token(WDGF.n#9);var .n#6(get,add,token);var get,token,var add,token(".n#678999887666666");var .n#->~>=>[lost?(token);get,token(var = token);var add,token();var token();var used?:.aa\?.url();if token();var token();get token(); if token();var fetch(if do use new but ut can is if go on re is old by switch to this new?(););
});
}
// Kald completion for at slutte
completion(result);
"""##
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let matches = regex.matches(in: testString, range: stringRange)
var result: [[String]] = []
for match in matches {
var groups: [String] = []
for rangeIndex in 1 ..< match.numberOfRanges {
let nsRange = match.range(at: rangeIndex)
guard !NSEqualRanges(nsRange, NSMakeRange(NSNotFound, 0)) else { continue }
let string = (testString as NSString).substring(with: nsRange)
groups.append(string)
}
if !groups.isEmpty {
result.append(groups)
}
}
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Swift 5.2, please visit: https://developer.apple.com/documentation/foundation/nsregularexpression