Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added more info about regular expression usage
  • Loading branch information
chrdavis committed Nov 1, 2019
1 parent e182f29 commit e6d5bcb
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/modules/powerrename/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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" |
Expand All @@ -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
Expand Down

0 comments on commit e6d5bcb

Please sign in to comment.