Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

Replace

Usage

Replace[expr, rules] applies a rule or list of rules in an attempt to transform the entire expression expr.
Replace[expr, rules, levelspec] applies rules to parts of expr specified by levelspec.


Notes

• Examples: Replace[x^2, x^2 -> a]LongRightArrow .
Replace[x + 1, x -> a]LongRightArrow .
• The rules must be of the form lhs -> rhs or lhs :> rhs.
• A list of rules can be given. The rules are tried in order. The result of the first one that applies is returned. If none of the rules apply, the original expr is returned.
• If the rules are given in nested lists, Replace is effectively mapped onto the inner lists. Thus Replace[expr, {{ ,  }, { , ... }, ... }] is equivalent to {Replace[expr, { ,  }], Replace[expr, { , ... }], ... }.
• Delayed rules defined with :> can contain /; conditions.
• Level specifications are described in Section A.3.6.
• The default value for levelspec in Replace is {0}.
• Replacements are performed to parts specified by levelspec even when those parts have Hold or related wrappers.
Replace takes a Heads option, with default setting Heads -> False.
• See Section 2.5.1.
• New in Version 1; modified in 4.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: