Update README.md

Added more info about regular expression usage
This commit is contained in:
Chris Davis 2019-10-31 09:14:30 -07:00 committed by GitHub
parent c1957272ea
commit 296be2fbd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@ The text to replace the instance(s) in the item name matched by the Search text
## Options
### Use Regular Expressions
If checked, the Search field will be interpreted as a regular expression. If not checked, the Search field will be used as a text to be replaced with the text in the Replace field.
If checked, the Search field will be interpreted as a regular expression. The Replace field can also contain regex variables (see examples below). If not checked, the Search field will be used as a text to be replaced with the text in the Replace field.
### Case Sensitive
If checked, the text specified in the Search field will only match text in the items if the text is the same case. By default we match case insensitive.
@ -53,9 +53,13 @@ Ex: txt.txt -> txt.NewExtension
For most use cases, a simple search and replace is sufficient. Other users will need more control over. That is where Regular Expressions come in. Regular Expressions define a search pattern for text. Regular expressions can be used to search, edit and manipulate text. The pattern defined by the regular expression may match one or several times or not at all for a given string. PowerRename uses the ECMAScript grammar, which is common amongst modern programming languages.
To enable regular expressions, check the "Use Regular Expressions" checkbox. Note: You will likely want to check "Match All Occurrences" while using regular expressions.
### Examples
| RegEx | Description |
Simple matching examples:
| Search for | Description |
| -------------- | ------------- |
| .* | Match all the text in the name |
| ^foo | Match text that begins with "foo" |
@ -64,7 +68,14 @@ For most use cases, a simple search and replace is sufficient. Other users will
| .+?(?=bar) | Match everything up to "bar" |
| foo[\s\S]\*bar | Match everything between "foo" and "bar" |
Note: you will likely want to check Match All Occurrences while using regular expressions
Matching and variable examples:
| Search for | Replace With | Description |
| ---------- | ------------- |--------------------------------------------|
| (.\*).png | foo\_$1.png | Prepends "foo\_" to the existing file name |
| (.\*).png | $1\_foo.png | Appends "\_foo" to the existing file name |
### External Help
There are great examples/cheat sheets available online to help you