is a global variable whose value, if set, is applied to the text or box form of every input expression before it is fed to the Wolfram Language.
$PreRead
is a global variable whose value, if set, is applied to the text or box form of every input expression before it is fed to the Wolfram Language.
Details
- $PreRead is always applied to each complete input string that will be fed to the Wolfram Language.
- In multiline input with a text‐based interface, whenever each line is terminated, $PreRead is typically applied to the input so far.
- $PreRead is applied to all strings returned by a $SyntaxHandler function.
- $PreRead is applied before InString[n] is assigned.
Examples
Basic Examples (3)
By default, $PreRead is not defined, meaning input strings are sent directly to evaluation:
$PreReadUse "hf" as an alias for HoldForm:
$PreRead = ReplaceAll[#, "hf" -> "HoldForm"]&{hf[2 + 3], hf[2 / 3]}FullForm[%]Restore $PreRead to its default value:
$PreRead=.Have the Wolfram Language print the FullForm of parsed input expressions before evaluation:
$PreRead = (Print[FullForm[#]];#)&;a + b^2a b(c + d)Restore $PreRead to its default value:
$PreRead=.Tech Notes
Related Guides
History
Introduced in 1991 (2.0)
Text
Wolfram Research (1991), $PreRead, Wolfram Language function, https://reference.wolfram.com/language/ref/$PreRead.html.
CMS
Wolfram Language. 1991. "$PreRead." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$PreRead.html.
APA
Wolfram Language. (1991). $PreRead. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$PreRead.html
BibTeX
@misc{reference.wolfram_2026_$preread, author="Wolfram Research", title="{$PreRead}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/$PreRead.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_$preread, organization={Wolfram Research}, title={$PreRead}, year={1991}, url={https://reference.wolfram.com/language/ref/$PreRead.html}, note=[Accessed: 13-June-2026]}