FIND YOUR NEXT FEW LINES

Results for “Text validation & parsing”

Small, practical examples. Search by task or narrow things down below.

547 snippets foundClear filters
PythonText validation & encoding

Extract named regex fields

Python: Use named capture groups to parse a known date-shaped identifier.

Python✓ Tested
JavaText validation & formatting

Extract successive regex matches

Java: Use a Matcher loop to find all unsigned integer tokens in Java text.

Java✓ Tested
Bash ScriptsText parsing & arithmetic

Format a numeric label with leading zeroes

Bash Scripts: Use a constant printf format string and supply values as separate arguments.

Bash Scripts✓ Tested
Bash ScriptsText parsing & arithmetic

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
C#Text validation & encoding

Normalize canonically equivalent Unicode strings

C#: Normalize to NFC before an ordinal comparison of equivalent character sequences.

C#✓ Tested
PythonText validation & encoding

Normalize equivalent Unicode strings

Python: Normalize to NFC before comparing canonically equivalent text.

Python✓ Tested
C#Text validation & encoding

Pad a numeric label to a fixed width

C#: Use a numeric format specifier to add leading zeroes.

C#✓ Tested
Bash ScriptsText parsing & arithmetic

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
JavaText validation & formatting

Process the lines of an in-memory string

Java: Use String.lines to handle common line terminators without retaining them.

Java✓ Tested
C#Text validation & encoding

Quote a literal search term for a regex

C#: Regex.Escape prevents metacharacters in a literal term from changing the pattern.

C#✓ Tested
Bash ScriptsText parsing & arithmetic

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
PythonText validation & encoding

Remove a known prefix safely

Python: Use removeprefix instead of lstrip when removing a literal prefix rather than a set of characters.

Python✓ Tested