While I'm learning RegEX, I'm trying to build a bash script to extract data from a file and then store it in variables, so I can work with the stored values to automatize my script.
I know the existence of SED and GREP, but I'm not sure how to use them properly.
The value I need is in a file called: /path/to/config.inc.php
mysql://user:password@server/user_database
So while I was learning RegEX (using the https://regexr.com/ website to learn), I was able to create this RegEX Expression:
(mysql\:\/\/)(.+.)\:(.+.)@(.+.)\/(.+)
So basically I need the USER, PASSWORD and USER_DATABASE values to be stored in the script in variables like:
user = $2
password = $3
userdatabase = $5
So I could call the variables inside the bash script to automatize some stuff. What would be the best approach to that?