Skip to content

Regex Rules Guide

Why regex exists in this plugin

Some Unity assets (especially serialized raw data assets) store localizable text inside text blobs. Regex rules let the plugin find those strings reliably during extraction.

Extraction pipeline

  1. Select asset and run extraction.
  2. Plugin uses the active Extraction Preset.
  3. Raw text regex scan runs only if the asset type is listed in Raw-Data Scan Types.
  4. Plugin chooses regex rules:
  5. Built-in rules by asset type (if available).
  6. Optional per-type custom rules are applied:
    • Replace Built-In enabled: only custom rules are used for that type.
    • Replace Built-In disabled: built-in and custom rules are merged.
  7. If no type rule is available, fallback rules from Project Settings > Hyper PO Localization are used.
  8. For each regex match, plugin reads capture groups from left to right.
  9. The first non-empty capture group becomes the extracted string.
  10. String is normalized and deduplicated.

Pattern requirements

  • Every pattern must include at least one capture group: (...).
  • Use precise key anchors when possible (_text, description, button, etc.).
  • Prefer non-greedy operators (*?) to avoid over-capturing.
  • Avoid patterns that match symbols-only fragments.

Common examples

  • JSON-like text field:
    • Pattern: _text\"\\s*:\\s*\"((?!_)[\\s\\S]*?)\"
  • XML-like button label:
    • Pattern: button=\"([^\"]*)\"

Faster setup

  • Select an asset in Project.
  • Open Project Settings > Hyper PO Localization.
  • In Per-Type Custom Regex Rules, click Import From Selected Asset.
  • The plugin creates a prefilled rule for that exact type name.

Troubleshooting

  • No strings extracted:
    • Pattern has no capture group.
    • Pattern does not match the serialized format used by that asset.
  • Too many noisy strings:
    • Pattern is too broad; add stronger anchors.
    • Use non-greedy quantifiers and narrower character classes.
  • Broken regex:
    • Validate in Regex Tester inside Project Settings before running extraction.