Category "pattern-matching"

How to do structural pattern matching in Python 3.10 with a type to match?

I am trying to match a type in Python 3.10 using the console: t = 12.0 match type(t): case int: print("int") case float: print("float") And I get t

How to get part of string from regex in Java

For example, I have string with range of earnings: 5 000-10 000 USD and i want to extract from that string minimum and maximum value. I prepared regexes, for e

Safe regex patterns from ReDos attack

I've recently faced with some redos attack issues. Explain in simple steps: Regex denial of services: it means the attacker can put some malicious/crafted input

Java string matching with wildcards

I have a pattern string with a wild card say X (E.g.: abc*). Also I have a set of strings which I have to match against the given pattern. E.g.: abf - false

Match list of words without the list of chars around

I have this regex (?:$|^| )(one|common|word|or|another)(?:$|^| ) which matches fine unless the two words are next to each other. One one's more word'word commo

Generic Ruby solution for SQLite3 "LIKE" or PostgreSQL "ILIKE"?

I am using SQLite3 for development and PostgreSQL for deployment. However, I am facing the following problem: My simple search using SQLite3: def self.search(