Skip to content

Commit 602538d

Browse files
committed
Ruby: add RegExpPatterns module
1 parent 71e393c commit 602538d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ruby/ql/lib/codeql/ruby/security/performance/RegExpTreeView.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ module RegExpFlags {
5959
}
6060
}
6161

62+
/**
63+
* Provides regular expression patterns.
64+
*/
65+
module RegExpPatterns {
66+
/**
67+
* Gets a pattern that matches common top-level domain names in lower case.
68+
*/
69+
string commonTLD() {
70+
// according to ranking by http://google.com/search?q=site:.<<TLD>>
71+
result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])"
72+
}
73+
}
74+
6275
/**
6376
* An element containing a regular expression term, that is, either
6477
* a string literal (parsed as a regular expression)

0 commit comments

Comments
 (0)