Results for “Text semantics”
Small, practical examples. Search by task or narrow things down below.
Extract digit sequences
Extract digit sequences using a complete Go program with explicit sample inputs.
Go✓ Tested
Extract named regex fields
Python: Use named capture groups to parse a known date-shaped identifier.
Python✓ Tested
Extract part of a string
Use one-based positions with substr.
substr✓ Tested
Extract successive regex matches
Java: Use a Matcher loop to find all unsigned integer tokens in Java text.
Java✓ Tested
Format a numeric label with leading zeroes
Bash Scripts: Use a constant printf format string and supply values as separate arguments.
Bash Scripts✓ Tested
Format several integers in a fixed buffer
Arduino / C: snprintf limits writes to the buffer size and includes a terminating null byte.
Arduino / C✓ Tested
Increment a counter without an unexpected errexit
Bash Scripts: An assignment avoids the zero-result exit status of a standalone arithmetic post-increment.
Bash Scripts✓ Tested
Insert values into a multiline template
PowerShell: A double-quoted here-string expands variable references.
PowerShell✓ Tested
Inspect a substring without allocating a copy
C++: A string_view refers to existing storage and must not outlive that storage.
C++✓ Tested
Inspect a URI through typed properties
PowerShell: The Uri class separates URL components without manual string splitting.
PowerShell✓ Tested
Iterate over all regular-expression matches
C++: A regex iterator yields successive matches without manually updating an offset.
C++✓ Tested
Join lines from two files side by side
Linux Commands: Use paste to pair lines by position with a chosen separator.
Linux Commands✓ Tested