75lb/renamer

Regex /^$/ can't work

mikcho opened this issue · 5 comments

renamer --find /^css$/ --replace wxss --force **/* can't work

75lb commented

Try using quotes.. and always use --dry-run to begin with:

renamer --find "/^css$/" --replace wxss --force "**/*" --dry-run
75lb commented

Also, see this issue

75lb commented

If you are using Git Bash, you need to escape the first forward slash, like this:

renamer --find "\/^css$/" --replace wxss --force "**/*" --dry-run

My OS is macOS, and some regex literals can't work with zsh,

Run:

renamer --find "/^css$/" --replace "scss" "**/*" --dry-run

Output:

Rename complete: 0 of 1 files renamed

Run:

renamer --find "/\bcss\b/" --replace "scss" "**/*" --dry-run

Output:

✔︎ style.css → style.scss 

Rename complete: 1 of 1 files renamed.

But file extension of style.css have not been change on filesystem.

75lb commented
renamer --find "/^css$/" --replace "scss" "**/*" --dry-run

This expression /^css$/ will only match whole filenames which exactly equal css. The output you got is correct, your regular expression is wrong.

But file extension of style.css have not been change on filesystem.

Remove the --dry-run option to change the file on the filesystem. The --dry-run mode is intended for practising or testing rename expressions. Remove --dry-run when you are ready to perform the actual rename.