Can I use "regular expressions" in rename rules for the Modify Links process?

Can I use "regular expressions" in rename rules for the Modify Links process?

Can I use "regular expressions" in rename rules for the Modify Links process?

Modified on: Wed, 18 Mar, 2026 at 9:20 AM

Answer

Yes. The Modify Links process supports regular expressions (regex), giving you powerful control over how link paths are searched and modified.

What are regular expressions?

Regular expressions (regex) are advanced search patterns used to find and replace text. They allow you to:
• Match text based on patterns, not just exact strings.
• Break string into parts and reassemble them in new ways.
• Handle complex link changes in bulk with precision.
Regex is built from:
• Special characters - symbols with unique meanings (example:  . , * , ^ )
• Literals - normal characters that match themselves (example: A)

Common special characters

Character
Meaning
Example
Matches
. (period)
Any single character (except newline)
a..
act, art, arc
* (asterisk)
Zero or more repetitions of the preceding charcter/pattern
tel*
tel, tell, telll...
\ (backslash)
Escapes a special character, making it literal
\.
Matches a period (.)
^ (caret)
Beginning of a string
^Or
Matches strings starting with "Once"
$ (dollar sign)
End of a string
end
Matches string ending with "end"
[ ] (brackets)
Match any one character in the set
[Aa]
 Matches a or A
[^ ]
Negates the set (matches anything not listed)
[^0
Matches any non-digit
- (hyphen inside brackets)
Defines a range
[A-Z]
Matches any uppercase letter

Hyphen Usage

  1.  Inside brakets: - defines a range (e.g., [0-9] matches any digit).
  2. Outside brackets: - is treated as literal character. 
  3. Escaping hypen: To include - inside a set, use a backslash
    1. Example: [+\-] matches either a plus or minus sign.
    2. [+-] would be invalid.

Repetition codes

Repetition codes {} let you control how many times a pattern must appear:

  1. p{x} → exactly x repetitions.
  2. p{x,} → at least x repetitions.
  3. p{x,y} → between x and y repetitions.
Example:
      [0-9]{1,} → matches any number with one or more digits (1, 33, 23496187).

Substitution example

  1. Search: Ave\.
  2. Replace: Avenue
  3. Input: 123 4th Ave.
  4. Output: 123 4th Avenue
Here, \. ensures the period is treated literally. Without the backslash, Ave. could match Ava Maria and incorrectly produce AvenueMaria.

Segments (capturing groups)

Segments allow you to capture parts of a string and reuse them:
  1. () → defines a segment.
  2. $1, $2, etc → references captured segments in replacements.
Examples:
  1. Filename conversion:
    1. Search: (.*)\.gif
    2. Replace: $1.jpg
    3. Result: C:\Folder\File.jpg
  2. Text rearrangement:
    1. Search: (.*)cats\. (.*)dogs\.
    2. Replace: $2fish. $1mice.
    3. Input: I like cats. I love dogs.
    4. Output: I love fish. I like mice.

Matching numbers with regex

Regex Pattern
Matches
Does NOT Match
[0-9]{1,}
Whole numbers (1, 33, 23496187)
Non-numeric strings
[0-9][0-9,]{3,}

Numbers ≥ 1,000 with/without commas (1,000, 1000, 999,999,999,999)

10, 100, 999
[0-9][0-9,]{1,}\.[0-9]{1,}
Numbers with decimals (10.0, 100.001, 1,234.567)
123, 123., .001
[0-9]{1,}[ ][0-9]{1,}/[0-9]{1,}
Mixed number (3 1/2, 8 7/16, 2271 17/22)
3/4, 1,000 1/2
[0-9]{1,}˚[ ]*[0-9]{1,}΄[ ]*[0-9]{1,}
Bearings (10˚ 17' 33", 10˚17'33")
10˚ 17', 17' 33"
[\+\-][0-9]{1,}
Signed whole number (-1, +1000, -100000)
-1,000, 1000
[xX]*[0-9A-Fa-f]{2,}
Hexadecimal (xF0, x00ff, 8010, abc, 0123456789aBcDeF)
F, 0, xyz

Note on commas: Avoid using [0-9,]{1,} - it matches invalid strings like (,), (1,2,3,4,5), (,,,,,,), or ,1. Use stricter patterns instead.

Tips & tricks

  1. (*) applies only to the character/pattern immediately before it, and can even match "nothing" 
  2. [ ] always represents a single character, even if multiple options are inside.
  3. Combine them: []* (with a space inside brackets) matches "zero or more spaces".
    1. Useful for handling variations like 100ft vs 100 ft.

Key takeaway

Regular expressions make Modify Links far more flexible than simple text substitution. They let you define patterns, capture segments, and handle complex link modifications with precision.