potiuk edited a comment on issue #17828:
URL: https://github.com/apache/airflow/issues/17828#issuecomment-906326525


   Yeah....
   
   <details>
     <summary>The test script: Click to expand!</summary>
   
   ```
   #!/bin/bash
   
   connection_url="$1"
   
   [[ ${connection_url} =~ 
([^:]*)://([^:@]*):?([^@]*)@?([^/:]*):?([0-9]*)/([^\?]*)\??(.*) ]] && \
           detected_backend=${BASH_REMATCH[1]} &&
           detected_user=${BASH_REMATCH[2]} &&
           detected_password=${BASH_REMATCH[3]} &&
           detected_host=${BASH_REMATCH[4]} &&
           detected_port=${BASH_REMATCH[5]} &&
           detected_schem=${BASH_REMATCH[6]} &&
           detected_params=${BASH_REMATCH[7]} &&
        echo "Backend='${detected_backend}'" &&
        echo "User='${detected_user}'" &&
        echo "Password='${detected_password}'" &&
        echo "Host='${detected_host}'" &&
        echo "Pprt='${detected_port}'" &&
        echo "Schema='${detected_schema}'" &&
        echo "Params='${detected_params}'"
   ```
   
   </details>
   
   And the result:
   
   ```
   ./test.bash "redis://redis-analytics-airflow.signal:6379/1"
   Backend='redis'
   User='redis-analytics-airflow.signal'
   Password='6379'
   Host=''
   Pprt=''
   Schema=''
   Params=''
   ```
   
   This is the embodiment of the famous ancient Chinese proverb (wisdom of the 
ancients):
   
   > If you have a problem, introduce regexp - you will have two problems.
   
   I will fix it without using regexps.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to