# Tag Info

Accepted

### How to make valid expressions with arbitrary number of named Blanks?

Not sure exactly how you want to use this, but the built in Distribute can do the work for you: ...
• 30.2k

### Change part of a list

Using SequenceSplit (new in 11.3) f = Flatten @ SequenceSplit[#, {1, 2, 1} :> {2, 1, 2}] &; lis1 ...
• 77.9k

### Replace zeros in a list with last nonzero value

list = {-1, -1, 0, 1, 0, 0, -1, -1, 1, 1, 1, 0, 0, 0, -1}; Using SequenceSplit with ...
• 77.9k

### StringContainsQ, but anywhere in order

A variant of NewStringContainsQFunction using StringPosition: ...
• 25.9k

### StringContainsQ And

list = {"abcd", "cdab", "acdb", "abdc"}; Using MapThread and ...
• 77.9k

### Put edges of a matrix to zero

a = Array[1 &, {5, 7}]; Border positions p = {{All, 1}, {All, -1}, {1, All}, {-1, All}}; Using `ReplaceAt (new in 13.1) <...
• 77.9k

### Put edges of a matrix to zero

Just another way and @kglr example: ...
• 62k

### How to write a rule that matches alternatives but return one of them always?

I really don't think that the duplication is egregious in this case, but you could avoid it with something like this: ...
• 30.2k

### How to make valid expressions with arbitrary number of named Blanks?

You can always use ReplaceRepeated (//.): ...
• 23.9k

### How to return a default value if no match is found in search of string

Using SequenceSplit (new in 11.3) ...
• 77.9k

...
• 77.9k

### Removing lists with zero at any position

list = Tuples[Range[-2, 2], 2]; Using Pick and ContainsNone (new in 10.2) ...
• 77.9k

### StringContainsQ And

list = {"abcd", "cdab", "acdb", "abdc"}; Using SequenceCases and ...
• 77.9k

### StringContainsQ, but anywhere in order

c = Characters["aabbckkdf"]; s = Characters["acd"]; Using DeleteElements (new in 13.1) ...
• 77.9k

### Finding words that start and end with same letter

res = Cases[WordList[], x_ /; StringTake[x, 1] == StringTake[x, -1]]; // AbsoluteTiming // First 0.033042 res // Length ...
• 77.9k

### Replacing a sub-partition (unordered list; multiset)

list = {{4, 4, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 2, 1}}; A variant of 1066's answer using SequenceReplace (new in 11.3) ...
• 77.9k

### Replace number in string with ? and /;

list = {"A4", "A#3"}; Map[StringJoin, Characters[list] /. {"A", d_?DigitQ, ___} :> {"B", d}] {"B4", "A#...
• 77.9k
1 vote

### Apply function to all first arguments of a nested list of rules

list = {1 -> a, 2 -> {3 -> c, 4 -> d, 5 -> {6 -> f, 7 -> {8 -> h, 9 -> j}}}}; Using ReplacePart <...
• 77.9k
1 vote

### Why does ReplaceRepeated work differently in numerator and denominator?

expr = 1/(a Sqrt[b]); Using NumeratorDenominator (new in 12.0) ...
• 77.9k
1 vote

### Creating rule-based sublists

Using Association and Merge ...
• 62k
1 vote

### How to return a default value if no match is found in search of string

Using s1 = "a-1_b-2_c-3_d-4"; s2 = "a-1_d-4"; Rule @@@ StringSplit[#, "-"] &@StringSplit[s1, "_"] will deal with first ...
• 62k
1 vote

### Put edges of a matrix to zero

A variant using BoxMatrix ...
• 4,921
1 vote

### How to apply ReplaceAll to denominator?

expr = y/x^2; Using NumeratorDenominator (new in 12.0) ...
• 77.9k
1 vote

### Sublist pattern matching

list = {{1, 2, 3}, {1, 2, 3}, {1, 2, 2, 3}, {1, 3, 3, 5}}; Using SequenceSplit (new in 11.3) ...
• 77.9k

Only top scored, non community-wiki answers of a minimum length are eligible