I've got strings "s=c=g++", where s, c ... (can be multiple values) mean extensions and g++ or any other value means a compiler. I've written 2 regex to parse compiler and extensions in given string:
compiler_pattern=".+(\w.+)$"
extensions_pattern="(\w+)?(?=\=)"
they work fine in python, but now I'm trying to use them in bash and I get this error
sed: -e expression #1, char 1: unknown command: `.'
How can it be fixed?
#!/bin/bash
archive=''
source=''
declare -a array=()
declare -A dictionary=()
while [ $# -gt 0 ]; do
  case "$1" in
    -a | --archive)
        archive=$2
    shift 2
        ;;
    -s | --source)
        source=$2
    shift 2
        ;;
    -c | --compiler)
        array+=($2)
        shift 2
        ;;
    *)
        shift 1 
    ;;
  esac
done
compiler_pattern=".+(\w.+)$"
extensions_pattern="(\w+)?(?=\=)"
for item in "${array[@]}"
do
  compiler=$(echo $item | sed $compiler_pattern)
  echo $compiler
done
about regex:
given "s=c=g++" -> compiler = g++, extensions = [s, c]
given "ipynb=py" -> compiler = py, extensions = ipynb
 
    