Skip to main content
added 6 characters in body; edited title
Source Link

How to replace the first occuranceoccurence in an expression instead of replacing all?

Is there a function that replaces the first occuranceoccurence of the expression instead of replacing all? For example, if I have HoldForm[x + 2 + 4 + x] /. x -> 4, is there a way to return 4+2+4+x4 + 2 + 4 + x?

How to replace the first occurance in an expression instead of replacing all?

Is there a function that replaces the first occurance of the expression instead of replacing all? For example, if I have HoldForm[x + 2 + 4 + x] /. x -> 4, is there a way to return 4+2+4+x?

How to replace the first occurence in an expression instead of replacing all?

Is there a function that replaces the first occurence of the expression instead of replacing all? For example, if I have HoldForm[x + 2 + 4 + x] /. x -> 4, is there a way to return 4 + 2 + 4 + x?

edited tags
Link
Kuba
  • 138.9k
  • 13
  • 297
  • 803
Tweeted twitter.com/#!/StackMma/status/514616648209563648
edited title
Link
Yituo
  • 1.5k
  • 10
  • 17

Replace How to replace the first occurance in an expression instead of replacing all?

edited title
Link
RunnyKine
  • 33.5k
  • 3
  • 111
  • 178
Loading
edited title
Link
RunnyKine
  • 33.5k
  • 3
  • 111
  • 178
Loading
Source Link
Yituo
  • 1.5k
  • 10
  • 17
Loading