Skip to main content
2 of 4
[Edit removed during grace period]
user13892
  • 9.8k
  • 2
  • 15
  • 44

How to define a Rule to match a Head except if it is a Part of another?

I have an expr which has List at various levels and I want to display them nicely as a column inside a frame but my problem is that the search for List goes inside things like DateObject to ruin their structure.

Replace[
    expr,
    x_List/;!MatchQ[...[...x...],DateObject[x,__]]:>Framed[Column@x]
    All
]

So how should I define such a Rule?

user13892
  • 9.8k
  • 2
  • 15
  • 44