# Extract selected captures as JSON

Choose one named capture and download only those values, preserving leading zeroes.

Source: https://help.smartfact.ai/patternbench/guides/extract-values

Audience: Operator

Choose one named capture and download only those values, preserving leading zeroes. This is isolated practice with invented records. Nothing is uploaded or written into a live system.

## Extract selected captures as JSON

1. **Enter a capture pattern**

   Enter a capture pattern.

   Each pair of letters and four digits forms an item code. Named groups make the two parts easier to reuse.

2. **Enter the item references**

   Enter the item references.

   Sarah is checking two item references from Brighouse works. The g flag requests all matches, not just the first.

3. **Set the replacement text**

   Set the replacement text.

   Named capture tokens reuse the matched letters and digits. Replacement text is never run as code.

4. **Run the pattern**

   Run the pattern.

   The worker finds two matches and produces a separate replacement preview. The original text remains unchanged.

5. **Open value extraction**

   Open value extraction.

   Extraction reads the completed match set. It does not run a new pattern or edit the source.

6. **Choose the numbered part**

   Choose the numbered part.

   Use the named number capture to keep leading zeroes in the extracted text.

7. **Choose a JSON array**

   Choose a JSON array.

   JSON preserves string values and distinguishes an unmatched capture as null. Plain text has different limits.

8. **Download the extracted values**

   Download the extracted values.

   The local file contains the two matched strings, including their leading zeroes. Review it before sharing.

[Watch or practise this chapter](https://help.smartfact.ai/patternbench/demo?guide=extract-values&chapter=extract-values&audience=office)

Review the result and its limits before using it in another application.
