|
| From: | Mart Frauenlob |
| Subject: | [Help-bash] ${var//!([[:class:]])} removing characters of the [:class:] |
| Date: | Sat, 26 Jan 2013 23:13:37 +0100 |
| User-agent: | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
Hello,am I wrong if I think that an extglob pattern of i.e. !([[:digit:]]) should match all non-digit characters? Why don't they match in the example below? Why are non-digit chars removed?
# cat extg
#!/bin/bash
shopt -s extglob
echo "address@hidden"
x=".:3:."
echo "Y${x}"
echo remove digits
echo "Y${x//@([[:digit:]])}"
echo remove non-digits
echo "Y${x//!([[:digit:]])}"
echo remove punct
echo "Y${x//+([[:punct:]])}"
echo remove non-punct
echo "Y${x//!([[:punct:]])}"
# /opt/bash42/bin/bash extg
4.2.42(1)-release
Y.:3:.
remove digits
Y.::.
remove non-digits
Y
remove punct
Y3
remove non-punct
Y
Best regards
Mart
| [Prev in Thread] | Current Thread | [Next in Thread] |