# Advanced Renamer .aren tags, patterns, and method order

This page accompanies the [JSON project reference](format-reference.md), based on Advanced Renamer 4.29. Tag expressions are strings inside JSON; they are not JSON variables or JavaScript template expressions.

## Method order and original filenames

Methods run from the first element of `methods` to the last. Text-editing methods such as Replace normally operate on the current name produced by earlier methods.

`<Name>` returns the **original** basename and `<Ext>` returns the **original** extension without a dot. They do not automatically refer to an earlier method's output.

With `applyto: "name"`, leave the extension out of the generated mask: `Photo_<Inc Nr:001>` preserves the current extension. With `applyto: "nameandextension"`, include the dot and extension explicitly: `Photo_<Inc Nr:001>.<Ext>`.

## Useful tags for generated projects

| Tag | Meaning / example |
| --- | --- |
| `<Name>` | Original basename, excluding the final extension. |
| `<Ext>` | Original extension without its leading dot. |
| `<Folder Name:1>` | Immediate containing folder; higher indices refer to ancestors. |
| `<Inc Nr:001>` | Increasing counter starting at 1, with explicit padding to at least three digits. |
| `<Inc Nr:010:2>` | Increasing counter starting at 10 and stepping by 2: `010`, `012`, `014`, … |
| `<Inc Nr:1>` | Counter starting at 1 with one-digit minimum padding. |
| `<Word:1>` | First word of the original basename using the effective word separators. |
| `<RWord:1>` | Last word of the original basename. |
| `<Word:1:1:->` | First word with an explicit hyphen word separator. |
| `<Substr:1:3>` | First three characters of the current basename. |
| `<Year>-<Month>-<Day>` | Current batch date, not a photo's capture date. |
| `<Year Modified>-<Month Modified>-<Day Modified>` | Filesystem modification date. |
| `<Year Created>-<Month Created>-<Day Created>` | Filesystem creation date, where available. |
| `<Img Year>-<Img Month>-<Img Day>` | Image/media date resolved by the application's metadata settings. |
| `<Img DateOriginal:yyyy-mm-dd>` | Original date from image metadata, when present. |
| `<Title>`, `<Author>` | Native metadata fields discovered when files are added; use the field name directly as a tag. |
| `<Metadata:FIELD>` | Access a native metadata field whose name clashes with a built-in tag. |
| `<ExifTool:FIELD>` | Access an ExifTool field only when native metadata support is lacking; requires the application's ExifTool integration. |

This table is a practical subset. See the [user guide's Tags section](https://www.advancedrenamer.com/user_guide/tags) for the tag catalog, discovery, and parameter rules. Tag names are case-insensitive.

Date/time formats use the application's date formatting conventions, for example `yyyy-mm-dd` and `hh-nn-ss` (`nn` is minutes). Do not substitute Python `%Y` syntax or JavaScript date formatting tokens.

## Native metadata tags and discovery

Advanced Renamer has extensive native metadata support. When files are added, the program analyses them and makes the discovered metadata fields available on the fly as first-class tags, using each field's name: for example, `<Title>` or `<Author>`. The available fields depend on the file format and the metadata present; they are not limited to the tags listed above.

`<Metadata:FIELD>` is only needed to disambiguate a metadata field name that clashes with a built-in tag: for example, `<Name>` means the original basename, while `<Metadata:Name>` accesses a metadata field named `Name` if one exists.

Use `<ExifTool:FIELD>` only when the program lacks native support for the required metadata. It is not the normal way to access image, audio, video, or document metadata.

Metadata-dependent masks need actual metadata in the input files. Missing metadata can produce blank components; use [tag fallback](#tag-fallback) when a value may be absent.

## Tag modifiers

Modifiers transform a tag's value before it is inserted into the filename. Append them inside the angle brackets, after the tag's own parameters. Modifiers can have parameters and can be chained; they run from left to right. Once modifiers begin, later parameters belong to modifiers, not to the original tag.

| Expression | Result |
| --- | --- |
| `<Title:lower>` | Lowercase title. |
| `<Title:substr:1:10:upper>` | First ten characters of the title, then uppercase. |
| `<Title:trim:replace: :_>` | Trim surrounding whitespace, then replace spaces with underscores. |
| `<Title:append: - scan>` | Append ` - scan` only when the title has a value. |
| `<Width:pad:4:0>` | Pad the width on the left with zeroes to at least four characters. |

Most modifiers leave empty values empty, including `append` and `prepend`. The exceptions are `default:text`, which supplies literal text, and `alt:tagname`, which tries another tag. For example, `<Title:alt:Subject:default:Untitled:lower>` chooses a value and then lowercases it.

See [Tag Modifiers in the user guide](https://www.advancedrenamer.com/user_guide/tag_modifiers) for the full list. A complete project with expected results is available in [Clean native metadata with tag modifiers](examples.md#32-clean-native-metadata-with-tag-modifiers).

## Tag fallback

Fallback supplies a value when a tag is empty:

- `<Title|Untitled>` uses the literal text `Untitled` if `Title` is empty.
- `<Title||Subject>` tries the `Subject` tag if `Title` is empty. Do not put angle brackets around the alternative tag name.
- `<Title||Subject|Untitled>` tries `Title`, then `Subject`, then the literal text `Untitled`, stopping at the first non-empty value.

Place the fallback chain before tag parameters and modifiers. The selected value is then formatted and modified: `<Title||Subject|Untitled:lower>` lowercases whichever value was selected, including the literal default. Similarly, `<Img Month||Month Modified:Xxxx>` formats the available month as a month name.

The `alt` and `default` modifiers offer control over when fallback happens within a modifier chain. For example, `<Title:lower:default:Untitled>` leaves the default as `Untitled`, while `<Title|Untitled:lower>` produces `untitled` when the title is empty.

See [Tag Fallback in the user guide](https://www.advancedrenamer.com/user_guide/tag_fallback) and the complete [Fall back between metadata tags and literal text example](examples.md#33-fall-back-between-metadata-tags-and-literal-text).

## Regex syntax inside JSON

Regex-enabled methods use the application's modified TRegExpr engine with Unicode matching. See the dedicated [regular expression reference](regex-reference.md) for JSON encoding and capture substitutions.

Set `"regularexpressions": true` on a supporting method and double backslashes in JSON: pattern `\d+` becomes `"\\d+"`. Replace and List Replace accept `$1` or `\1` for group 1; JSON encodes these as `"$1"` or `"\\1"`. Lowercase a capture with `\L$1` or `\L\1`, and uppercase it with `\U$1` or `\U\1`. Bare `\L1` and `\U1` produce literal `1`, not captured text. See the [replacement and JSON escaping notes](regex-reference.md) for exact forms.

## Non-regex replacement is not always literal

In the Replace method, with regular expressions disabled:

- `/` and `\` separate multiple search patterns.
- `*` can activate wildcard matching.
- Matching is case-insensitive unless `casesensitive` is true.
- `occurrence: 0` replaces all matches; positive values select an occurrence.

## Positions and characters

For common positional edits, use one-based positions encoded as strings: `"position": "1"`, `"start": "1"`, `"count": "3"`. For Add, `"position": "0", "backwards": true` appends to the selected portion. More complex position/count fields can interpret patterns and tags according to the method's rules; do not assume they are arithmetic expressions.

