Skip to content

Commit

Permalink
docs: multiline pattern issue in windows vs linux (#1678) (#1685)
Browse files Browse the repository at this point in the history
* closes #1678
  • Loading branch information
b31ngd3v committed Jun 7, 2022
1 parent 656cc4f commit 28c8842
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cve_bin_tool/checkers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ A few ways to do it:
or similar) you can grep for that and then look at the history to see what valid patterns
look like.

### Multi-line version patterns

In Windows, a new line is denoted using "\r\n" and in Linux it's "\n".

For example, if the version string looks like this:

```
<artifactId>commons-compress</artifactId>
<version>1.16.1</version>
```

Then a good regex signature for this will be `r"<artifactId>commons-compress</artifactId>\r?\n <version>([0-9]+\.[0-9]+(\.[0-9]+)?)</version>"`. And in case of the mapping tests, the `version_strings` parameter doesn't support regex strings, so just use "\r\n" to indicate a new line.

### Avoiding false positives (beware the X.X.X version pattern!)

It can be very tempting to have a version pattern that matches `X.X.X` where `X` is a number
Expand Down

0 comments on commit 28c8842

Please sign in to comment.