✏️ Small diff in dye's implementation of regex
This commit is contained in:
parent
c9f1a4a757
commit
286395a230
1 changed files with 1 additions and 1 deletions
|
|
@ -77,7 +77,7 @@ hex_to_rgb() {
|
|||
|
||||
# parse_rgb() takes rgb string to pass to rgb_to_hex()
|
||||
parse_rgb() {
|
||||
local regex='^\s?rgb[a]?[(][0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}[)]$|^rgb[a]?[(][0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}, [0-1]?.[0-9][0-9]?[)]\s?$'
|
||||
local regex='^rgb[a]?[(][0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}[)]$|^rgb[a]?[(][0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}, [0-1]?.[0-9][0-9]?[)]$'
|
||||
if [[ $2 =~ $regex ]]; then
|
||||
local numbers
|
||||
numbers=$(echo "$2" | sed -n 's/.*\(([^()]*)\).*/\1/p' | sed 's/[()]//g' | sed 's/,\s/ /g')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue