Results for “Text cleanup & matching”
Small, practical examples. Search by task or narrow things down below.
Validate a complete identifier with a regex
C#: Use absolute anchors and a timeout so the regex checks the complete input with a bounded execution time.
C#✓ Tested
Validate an entire identifier
Python: Use fullmatch so a regex must consume the complete input.
Python✓ Tested
Write a multiline string without expanding variables
PowerShell: A single-quoted here-string preserves dollar signs literally.
PowerShell✓ Tested
Clean up a temporary directory automatically
Python: Use TemporaryDirectory as a context manager so cleanup also happens after exceptions.
Python✓ Tested
Declare LF normalization for a file type
Git: A gitattributes rule records text normalization expectations for matching paths.
Git✓ Tested
Remove a filename extension
Keep the path while removing its final extension.
filename✓ Tested
Accept either of two conditions
SQL: Use OR to keep matching names or out-of-stock rows.
SQL✓ Tested
Accept either of two conditions
SQL Server: Use OR to keep matching names or out-of-stock rows.
SQL Server✓ Tested
Accept either of two conditions
Postgres: Use OR to keep matching names or out-of-stock rows.
Postgres✓ Tested
Accept either of two conditions
SQLite: Use OR to keep matching names or out-of-stock rows.
SQLite✓ Tested
Add days to a date
Use DATEADD for date arithmetic.
DATEADD✓ Tested
Add days to a date
Use a date modifier for calendar arithmetic.
date✓ Tested