Top "Pattern-matching" questions

Use this tag for questions about testing whether a data structure has a particular shape or contains particular values in certain locations.

Scala regex Named Capturing Groups

In scala.util.matching.Regex trait MatchData I see that there support for groupnames , I thought that this was related …

regex string scala pattern-matching capturing-group
How can I pattern match on a range in Scala?

In Ruby I can write this: case n when 0...5 then "less than five" when 5...10 then "less than ten" else "a …

scala pattern-matching range
unix: how to tell if a string matches a regex

Trying out fish shell, so I'm translating my bash functions. The problem is that in one case, I'm using bash …

regex linux unix pattern-matching fish
Explaining pattern matching vs switch

I have been trying to explain the difference between switch statements and pattern matching(F#) to a couple of people …

f# pattern-matching ocaml sml
Java regular expression with lookahead

is there a way to print out lookahead portion of a regex pattern in java? String test = "hello world this …

java regex pattern-matching regex-lookarounds
PostgreSQL case insensitive SELECT on array

I'm having problems finding the answer here, on google or in the docs ... I need to do a case insensitive …

sql postgresql pattern-matching case-insensitive
Record type pattern matching in Ocaml

I'm trying to use pattern matching to write a calculator application. Two major types defined as below: type key = Plus | …

types pattern-matching ocaml record
What is the idiomatic way to pattern match sequence comprehensions?

val x = for(i <- 1 to 3) yield i x match { case 1 :: rest => ... // compile error } constructor cannot be instantiated …

scala pattern-matching for-comprehension
Swift 2 - Pattern matching in "if"

Recently I've saw the WWDC 2015 keynote from Apple. I also looked at some documentation but I can't find a "pattern …

swift if-statement syntax pattern-matching swift2
Pattern Matching - Prolog vs. Haskell

This is not a homework question, rather an exam study guide question. What is the difference between pattern matching in …

haskell prolog pattern-matching