{{ message }}

# add warning for regular expression with [/\]#2043

Closed
opened this issue Sep 8, 2021 · 3 comments
Closed

# add warning for regular expression with [/\]#2043

opened this issue Sep 8, 2021 · 3 comments
Labels

### asottile commented Sep 8, 2021 • edited

 pre-commit normalizes slashes to forward slashes since 2.5.0 (and further back to 1.19.0 for per-hook configuration) there's already a similar warning for /* so this should be a fairly beginner-friendly changeset The text was updated successfully, but these errors were encountered:

### dogukanteber commented Sep 14, 2021 • edited

 Can you open up the issue a little more, please? I'd like to fix this issue but I could not understand the problem exactly.

### asottile commented Sep 14, 2021

 right now, one may write something like:  files: ^somedir[/\].*\.py$# or exclude: ^somedir[\/]otherdir[\/].*\.py$ expecting that they need to match both posix paths somedir/foo/bar.py and windows paths somedir\foo\bar.py -- however this is unnecessary because pre-commit normalizes all slashes to forward slashes there's a similar regular expression warning for doing something like files: whatever/*.py where someone assumes that it is a glob and not a regex

added a commit to radek-sprta/pre-commit that referenced this issue Sep 17, 2021
 Add warning for regular expression with [\/] (pre-commit#2043) 
 0cb5250 
mentioned this issue Sep 17, 2021
added a commit to radek-sprta/pre-commit that referenced this issue Sep 22, 2021
 Add warning for regular expression with [\/] (pre-commit#2043) 
 cef9c4a 
added a commit that referenced this issue Sep 22, 2021
 Merge pull request #2053 from radek-sprta/master 
 ef7b126 
Add warning for regular expression with [\/] (#2043)

### asottile commented Oct 2, 2021

 via #2053