Results for “Text cleanup & matching”
Small, practical examples. Search by task or narrow things down below.
Treat an empty trimmed value as missing
SQL: NULLIF converts an empty string to NULL before a fallback is applied.
SQL✓ Tested
Treat an empty trimmed value as missing
SQL Server: NULLIF converts an empty string to NULL before a fallback is applied.
SQL Server✓ Tested
Treat an empty trimmed value as missing
Postgres: NULLIF converts an empty string to NULL before a fallback is applied.
Postgres✓ Tested
Treat an empty trimmed value as missing
SQLite: NULLIF converts an empty string to NULL before a fallback is applied.
SQLite✓ Tested
Replace all matching text
Normalize repeated whitespace with a regular expression.
regexp_replace✓ Tested
Run cleanup around a custom context
Python: Use try/finally inside a contextmanager so cleanup runs even on failure.
Python✓ Tested
Count matching lines
Linux Commands: Use grep -c to count matching lines rather than individual occurrences.
Linux Commands✓ Tested
Exclude matching lines
Linux Commands: Use grep -v to retain lines that do not start with a comment marker.
Linux Commands✓ Tested
Print only the matching portions
Linux Commands: Use extended regex and -o to extract digit sequences.
Linux Commands✓ Tested
List matching files
Enumerate immediate text files and sort their names in C#.
C#✓ Tested
Search for text in a file
Find matching lines with their line numbers, ignoring letter case and treating the pattern as literal text.
grep✓ Tested
Accept several lines of text
HTML: Learn how to accept several lines of text in a complete browser example.
HTML✓ Tested