Skip to content

Commit 4e2b990

Browse files
asgerferik-krogh
andcommitted
Add doc string to semVerToken
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
1 parent 0ddd825 commit 4e2b990

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

javascript/extractor/src/com/semmle/js/dependencies/DependencyResolver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ private void addConstraint(Constraint constraint) {
5757
}
5858
}
5959

60-
private static final Pattern semVerToken = Pattern.compile("[~^<>=|&-]+|\\d+(?:\\.[\\dx]+)+(?:-[\\w.-]*)?");
60+
// Matches either a version ("2.1.x" / "3.0", etc..), or a version constraint operator ("<", "||", "~", etc...).
61+
private static final Pattern semVerToken = Pattern.compile("\\d+(?:\\.[\\dx]+)+(?:-[\\w.-]*)?|[~^<>=|&-]+");
6162

6263
/**
6364
* Returns the first version number mentioned in the given constraints, excluding upper bounds such as `< 2.0.0`,

0 commit comments

Comments
 (0)