Results for “Text validation & formatting”
Small, practical examples. Search by task or narrow things down below.
Parse an integer without throwing on invalid input
PowerShell: TryParse reports conversion success separately from its output value.
PowerShell✓ Tested
Parse digits with leading zeroes as decimal
Bash Scripts: The 10# prefix avoids Bash treating a leading zero as an octal notation.
Bash Scripts✓ Tested
Pass a block of behavior as an argument
PowerShell: Invoke a scriptblock with the call operator and an explicit input value.
PowerShell✓ Tested
Pass an environment value to a child process
PowerShell: The process environment is inherited by a launched child PowerShell process.
PowerShell✓ Tested
Preserve a failure after local cleanup
PowerShell: A bare throw inside catch rethrows the current exception.
PowerShell✓ Tested
Print a selected range of lines
Linux Commands: Use sed -n with a line address to suppress other output.
Linux Commands✓ Tested
Print only the matching portions
Linux Commands: Use extended regex and -o to extract digit sequences.
Linux Commands✓ Tested
Print the final lines of a file
Linux Commands: Use tail -n for a fixed-size suffix of a log.
Linux Commands✓ Tested
Provide read-only application configuration
Provide read-only application configuration with a small React component and explicit browser behavior.
React✓ Tested
Read an uncontrolled form with FormData
Read an uncontrolled form with FormData with a small React component and explicit browser behavior.
React✓ Tested
Read fields captured by a Bash regular expression
Bash Scripts: BASH_REMATCH contains the full match followed by capture groups after a successful regex test.
Bash Scripts✓ Tested
Read named fields from a successful regex match
PowerShell: The Matches table is updated after a successful scalar match operation.
PowerShell✓ Tested