# sed Simulator

Simulate substitutions, line deletion, and selected-line printing on pasted ASCII text with a bounded browser-side regex subset.

## URL

https://ilham.dev/tools/sed-simulator/

## What It Does

Simulate a bounded subset of sed on pasted ASCII text. Choose substitution, deleting matching lines, or printing matching lines. Substitutions support first or global replacement, case-insensitive matching, whole-match insertion with &, and printing only lines with a substitution. This tool does not execute arbitrary sed scripts or edit files.

## Features

- Simulate substitution, deleting matching lines, and printing matching lines
- Choose first or global replacement, ignore case, and substitution-only printing
- Insert the whole match with ampersand in replacements
- Preserve the source and copy a separate output

## Input

ASCII sample, pattern, replacement, and operation settings text input.

## Output

Simulated sed output and matched-line summary text output.

## Privacy

Processing happens locally in the browser.

No input data is uploaded to ilham.dev.

- Requires login: false
- Requires API key: false
- Stores user data: false


## Examples

- Is this GNU sed running in the browser?
- Can I use captured groups in the replacement?
- Does this overwrite my original text or save it?
- What are the simulation limits?


## Limitations

- Bounded ASCII/C-locale subset, not GNU sed or arbitrary script execution
- No capture backreferences, case conversions, hold space, addresses, or multiline commands
- Maximum 50,000 input characters, 256 pattern characters, 500 states, and 200,000 output characters
- Files and in-place edits are not performed


## Related Tools

- https://ilham.dev/tools/grep-simulator/
- https://ilham.dev/tools/sed-replacement-builder/


## Questions

### Is this GNU sed running in the browser?

No. A local bounded regex engine implements the documented ASCII/C-locale subset with leftmost-longest whole-match selection. It does not implement full sed, capture backreferences, case-conversion escapes, hold space, multiline commands, or arbitrary script execution.

### Can I use captured groups in the replacement?

Grouping can organize a pattern, but replacement backreferences such as \1 are not implemented. Use & for the complete match. Unsupported replacement escapes are rejected rather than guessed.

### Does this overwrite my original text or save it?

No. The output is separate from the original sample. Processing happens locally without tool input storage or upload. Clear sample removes the sample and result while leaving the selected options unchanged.

### What are the simulation limits?

Up to 50,000 ASCII input characters, 5,000 lines, 5,000 characters per line, 256 pattern characters, and 1,000 replacement characters. Finite repetition bounds are limited to 50, compiled patterns to 500 states, and output to 200,000 characters. A bounded work budget rejects expensive simulations.

