Skip to content
/ strglob Public

⏩ Shared library that expands supplied globbing pattern syntax into multiple strings

Notifications You must be signed in to change notification settings

decal/strglob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strglob 💬

Description 📄

  1. strglob is a C development library designed to enumerate characters/numbers/strings by expanding "globbing" pattern syntax
  2. Its purpose is to provide a compact specification for test case input string generation.

strglob Features 📊

strglob supports a wide variety of syntax types for both character and string generation including:

  1. ranges 🎲 * alphabetic ranges
    • [e-i] => e f g h i (lowercase)
    • [A-C] => A B C (uppercase) * numeric ranges
    • [0-4] => 0 1 2 3 4 (zero inclusive natural numbers)
    • [10-14] => 10 11 12 13 14 (multiple digits) * negative numeric ranges
    • [-2-2] => -2 -1 0 1 2 (real numbers and whole numbers)
    • [-4--2] => -4 -3 -2 (real numbers only) * zero-prepended numeric ranges
    • [01-03] => 01 02 03 (both limits)
    • [01-4] => 01 02 03 04 (first only)
    • [0-02] => 0 1 2 (last only) * reverse ranges
    • [c-a] => c b a (alphabetic characters)
    • [3-1] => 3 2 1 (numeric digits)
    • [-1--3] => -1 -2 -3 (negative integers)
    • [2--1] => 2 0 1 -1 (real numbers) * sequence expression ranges
    • {d..b} => d c b (reverse range of alphabetic characters)
    • {a..f..2} => a c e (alphabetic range with increment value)
    • {1..3} => 1 2 3 (numeric range)
    • {-2..2} => -2 -1 0 1 2 (negative numeric range)
    • {0..6..2} => 0 2 4 6 (numeric range with increment value)
  2. classes 🎐 * character classes
    • [:digit:] => 0 1 2 3 4 5 6 7 8 9 0 [numeric digits](
    • [:reserved:] => ! # $ & ' ( ) * + , / : ; = ? @ [ ] percent-encoding reserved characters * string classes
    • {:wdays:} => sun mon tue wed thu fri sat sun (lowercase weekdays)
    • {:Wdays:} => Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec (capital weekdays)
    • {:WDAYS:} => JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC (uppercase weekdays)
  3. sets 📍 * string sets
    • {a,b,c} => a b c (logical and)
  4. shell features 🎫 * environment expansion
    • {$LOGNAME} => decal (login name variable) * file includes
    • {/etc/issue.net} => Ubuntu 16.04.4 LTS (identification file for telnet sessions)

Note that.. 📝

Numeric and character ranges are denoted by square brackets

Strings are signified with curly braces

Range limits are delimited by dashes which are also for signing negative integers

String sets are separated by commas

Both character and string class names are surrounded by colons

Character class identifiers are taken from the standard C library's ctype.h header file

Bash-style sequence expressions are specified with curly braces and take an optional numeric increment value

Related Documentation 📚

cURL Influence ➰

strglob behaves similar to the lists and ranges implemented by curl on the command line:

  • curl 'https://host.dom/{foo,bar,baz}/'

    • https://foo
    • https://bar
    • https://baz
  • curl 'https://host.dom/[0-2]/'

    • https://0
    • https://1
    • https://2
  • Refer to the URL globbing section in Everything curl for more information.