Lakshmikanth2001 / GitHooks

Git Hooks VS-Code Extension
https://marketplace.visualstudio.com/items?itemName=lakshmikanthayyadevara.githooks
Other
7 stars 2 forks source link

Building Regex for file path inside `./.git/hook` in vscode extension #5

Closed Lakshmikanth2001 closed 1 year ago

Lakshmikanth2001 commented 1 year ago
9AMTech commented 1 year ago

I was trying to find the file for this so I can do the whole pull request thing. (New to open source, sorry.) I couldn't find the relevant code, but try this regex.

(\/git\/hook\/)
Lakshmikanth2001 commented 1 year ago

Thank You for your suggestion based on your regex pattern i have build an another regex for this logic

/(\/\.git\/hooks\/)/ this is simple you can got to package.json and edit editor/title when clause and submit a pull

request, i hope this will be your first pull request to break the ice 😀

This Regex builder website can help you

9AMTech commented 1 year ago

Thanks for the opportunity! I love using regexr. It's the best tool for issues like this! I submitted the pull request w/ the correct regex.

Lakshmikanth2001 commented 1 year ago
"when": "resourcePath =~ /(\/\\.git\/hooks\/)/ || resourcePath =~ /(\\.git\\\\hooks\\\\)/",

Final regex which was working for both mac and windows is this one thank you for your contribution

i want to share small code snippet which can help in in budling regex inside string ( node.js env )

var regexParten = /(git\\hooks\\)/
regexParten.source 
'(\\\\.git\\\\hooks\\\\)'

it help when your regex contains string escape characters ,

Thank You for your contribution