Unprotect
Unprotect[patt1,patt2,…]
unprotects all symbols whose names textually match any of the arbitrary string patterns patti.
Unprotect[{spec1,spec2,…}]
unprotects any symbols that are equal to or whose names match any of the speci.
Details
- A typical sequence in adding your own rules for built‐in functions is Unprotect[f];definition;Protect[f]. »
- The pattern patt can be given as a string with metacharacters, as StringExpression[…] or as RegularExpression["regex"]. »
- Unprotect allows abbreviated string patterns containing the following metacharacters:
-
* zero or more characters @ one or more characters, excluding uppercase letters - Unprotect["context`*"] unprotects all symbols in a particular context. »
- Unprotect["`*"] unprotects all symbols in the current context. »
- Unprotect does not affect symbols with the attribute Locked. »
- Unprotect has attribute HoldAll. »
Examples
open allclose allScope (7)
Symbol Inputs (2)
Using Patterns (5)
Specify symbols to unprotect as string patterns:
Unprotect all symbols in the current context:
Unprotect all symbols in a given context:
Unprotect all 2-character symbols in the current context using StringExpression:
The symbols x1 and x2 were unprotected, but y remains unaffected:
Unprotect all 3-character symbols in the current context using RegularExpression:
Applications (2)
Properties & Relations (6)
Unprotect[pattern] unprotects the same symbols as Unprotect/@Names[pattern]:
Protecting a symbol is equivalent to setting the Protected attribute:
Unprotecting a symbol is equivalent to clearing the Protected attribute:
Unprotecting a symbol does not clear other attributes:
Unprotect returns the list of symbols actually unprotected:
If a symbol is already unprotected, it is not unprotected again:
No more definitions can be made for a protected symbol:
To modify definitions of a protected symbol, unprotect it first:
Unprotect has the attribute HoldAll:
Possible Issues (2)
Unprotect does not affect locked symbols:
When using a pattern without a context mark, all matching symbols on $ContextPath are unprotected:
The symbol xy was unprotected, along with several system symbols:
Use a pattern with an explicit context mark to avoid potentially matching symbols from system or other contexts:
Text
Wolfram Research (1988), Unprotect, Wolfram Language function, https://reference.wolfram.com/language/ref/Unprotect.html (updated 2022).
CMS
Wolfram Language. 1988. "Unprotect." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Unprotect.html.
APA
Wolfram Language. (1988). Unprotect. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Unprotect.html