-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using CLI with RegExp and a config file in version 8 #197
Comments
Thank you, I'll have a look shortly! |
I think if you are using a regex in the JSON config now, then you don't need to use the Try not using the I have updated the readme accordingly and released a new version 8.0.2 to better handle this. |
Hi @adamreisnz, And how is detected that I am writing a regular expression? The config was a Just check the code in the minimum reproducible repo and remove the Replacing '/\/\w{3} \d{3}\/g/' with 'replaced'
No files were changed
✨ Done in 0.15s. If I try to use only CLI parameters, removing completely the |
I am seeing that you are checking if the // correct
new RegExp('\\w+') // /\w+/
// incorrect
new RegExp('/\\w+/') // /\/\w+\// |
Ahh, yes, gotcha, thank you. |
Thanks @adamreisnz, |
Hi there,
I am trying to update to version 8 one of my repos. I have converted the config file to
JSON
, double escaped the escaped characters and added the--isRegex
flag. But I am receiving the next error:TypeError: from.replace is not a function at main (file:///xxx/node_modules/replace-in-file/bin/cli.js:37:24) error Command failed with exit code 1.
I have prepared a minimum reproducible repo so maybe you can spot what is the issue there.
yarn replace
first (it runs without issues and replace the string in the file)yarn replace-regexp
Could you indicate if I am missing something here?
Regards
The text was updated successfully, but these errors were encountered: