Results for “pattern”
Small, practical examples. Search by task or narrow things down below.
Branch on whether a pattern exists
Linux Commands: Use grep -q in a conditional so an ordinary no-match result is not an unhandled failure.
Linux Commands✓ Tested
Classify a filename with shell patterns
Bash Scripts: Case patterns support alternatives without launching an external regex tool.
Bash Scripts✓ Tested
Dispatch values with wildcard patterns
PowerShell: Switch -Wildcard interprets shell-style matching patterns for each clause.
PowerShell✓ Tested
Handle a filename pattern with no matches
Use nullglob so an unmatched pattern produces an empty array.
nullglob✓ Tested
List release tags matching a pattern
Git: Use a tag pattern and version-aware sorting for release labels.
Git✓ Tested
Match any pattern from a file
Linux Commands: Use grep -F -f with one literal pattern per line.
Linux Commands✓ Tested
Narrow an object using a type pattern
C#: A successful is pattern introduces a strongly typed local variable.
C#✓ Tested
Narrow an object with a pattern variable
Java: Pattern matching avoids a separate cast after a successful instanceof check.
Java✓ Tested
Parse a date with an explicit input pattern
Java: Use DateTimeFormatter for a non-ISO date representation.
Java✓ Tested
Play a fixed digital output pattern
Arduino / C: A pattern table separates the output sequence from its timing.
Arduino / C✓ Tested
Prevent a variable value from expanding as a filename pattern
Bash Scripts: Quote a variable to pass its literal contents even when matching filenames exist.
Bash Scripts✓ Tested
Remove a known prefix with a shell pattern
Bash Scripts: The hash expansion removes the shortest matching prefix without changing the original variable.
Bash Scripts✓ Tested