DEV Community

Samandar Ravshanov
Samandar Ravshanov

Posted on

๐Ÿ“ฆ Check if the given string is a POSIX bracket expression.

Returns True if the given string is a POSIX bracket expression (POSIX character class)

from functorflow import f

print(f('is-posix-bracket', '[foo:]]'))
# False
print(f('is-posix-bracket', '[xdigit:]]'))
# False
print(f('is-posix-bracket', '[[:xdigit:]]'))
# True
print(f('is-posix-bracket', '[[:xdigit:]]'))
# True
print(f('is-posix-bracket', '[[:alpha:]123]'))
# True
print(f('is-posix-bracket', '[[:alpha:]123]'))
# True
print(f('is-posix-bracket', '[a-c[:digit:]x-z]'))
# True
print(f('is-posix-bracket', '[:al:]'))
# True
print(f('is-posix-bracket', '[abc[:punct:][0-9]'))
# True
Enter fullscreen mode Exit fullscreen mode

Top comments (0)