Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 52386

Questions on expression testing and manipulation through pattern matching and constructing efficient patterns.

2 votes

Unexpected behavior using `ReplaceAll[]` for nested lists

The issue is that the provided pattern also matches the outer list. Therefore ReplaceAll[] replaces the outer list and stops (as there are no elements left). To overcome this issue, Map[] must be use …
Dennis Guse's user avatar
10 votes
2 answers
267 views

Unexpected behavior using `ReplaceAll[]` for nested lists [duplicate]

ReplaceAll[] might lead to unexpected behavior (at least it surprised me). I use ReplaceAll[] to convert a list (basically data cleanup). For the command: {{1, "2"}, {2, "3"}} /. {x_, _ } :> {x, "SO …
Dennis Guse's user avatar
5 votes
1 answer
482 views

Use cases to select subelements by Regex

I have a nested list and would like to select a sub set of lists using a RegEx and I would prefer to use patterns (mainly for readability). list = { {"1", "abc"}, {"2", "abd"}, {"3", "c"} } W …
Dennis Guse's user avatar