File tree Expand file tree Collapse file tree
actions/ql/lib/codeql/actions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -787,5 +787,20 @@ module Bash {
787787 * Holds if the given regex is used to match an alphanumeric string
788788 * eg: `^[0-9a-zA-Z]{40}([0-9a-zA-Z]{24})?$`, `^[0-9]+$` or `^[a-zA-Z0-9_]+$`
789789 */
790- string alphaNumericRegex ( ) { result = "^\\^\\[([09azAZ_-]+)\\](\\+|\\{\\d+\\})\\$$" }
790+ string alphaNumericRegex ( ) {
791+ exists ( string r1 , string r2 , string r3 , string r4 |
792+ // An alphanumeric character class
793+ r1 = "\\[([09azAZ_-]+)\\]" and
794+ // The same as above, followed by a quantifier like `+` or `{20}`
795+ r2 = r1 + "(\\+|\\{\\d+\\})" and
796+ // The same as above, possibly with brackets around it
797+ r3 = "\\(?" + r2 + "\\)?" and
798+ // The same as above, possibly with a `?` after it
799+ r4 = r3 + "\\??"
800+ |
801+ // The same as above, repeated one or more times, and with `^` at the
802+ // beginning and `$` at the end
803+ result = "^\\^(" + r4 + ")+\\$$"
804+ )
805+ }
791806}
You can’t perform that action at this time.
0 commit comments