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.

notepad++ Inverse Regex replace (all but string)

I essentially wish to match every line that DOES NOT contain this string "Hello" Example: sdfsdoifdoskf fdgokfdghodfkg hello fdojgohdfgjkdfg gfobjobhkdfokgdfg …

regex pattern-matching notepad++ inverse
Can a range be matched in Scala?

Is it possible to match a range of values in Scala? For example: val t = 5 val m = t match { 0 until 10 =&…

scala pattern-matching range matching
Search for string allowing for one mismatch in any location of the string

I am working with DNA sequences of length 25 (see examples below). I have a list of 230,000 and need to look …

python string pattern-matching string-matching dna-sequence
How to pattern match on generic type in Scala?

Let's suppose we have a generic class Container: case class Container[+A](value: A) We then want to pattern match …

scala pattern-matching type-erasure
RegEx in Node/Javascript - how to get pattern match bounds?

Currently, I'm using regex in Javascript / Node via find() and that works for finding the beginning of the pattern. But …

javascript node.js pattern-matching bounds
Lua: How to check if a string contains only numbers and letters?

Simple question may have a simple answer, but my current solution seems horrible. local list = {'?', '!', '@…

lua pattern-matching alphanumeric non-alphanumeric
Rust pattern matching over a vector

The tutorial shows some very basic examples of pattern matching, such as matching over an integer to emulate a c-style …

vector pattern-matching rust rust-obsolete
Best machine learning technique for matching product strings

Here's a puzzle... I have two databases of the same 50000+ electronic products and I want to match products in one …

machine-learning pattern-matching string-comparison levenshtein-distance
Why parse error? Indentation?

I wrote this code: addNums key num = add [] key num where add res a:as b:bs | a == [] = res | otherwise = …

haskell pattern-matching indentation parse-error
Detect a specific shape using OpenCV

I'm still a beginner in OpenCV. Currently, I'm trying to detect a specific shape as in the image in the …

image-processing opencv pattern-matching shape matching