REGEX help required and some sed/awk help as well

Hi guys,

I am coding a bash script that makes use of php scripts to pull URL's from a website. These url links will have numbers in them like 0.2.3
I want to make a regex that will yield me such numbers if I use a command like preg_grep.

Question1: I need a regex that will tell my preg_grep to get any three digit number separated by two dots. Would d\.d\.d be an appropriate regex?

Question2: As well once I get the number I need to strip it of its dots. In bash would this tactic work for numbers:

$ foo=1.2.3
$ echo "${foo//./}"
testtesttest

Or should I use sed?

But in php could I use the following

$var1 = "10.000";
$var1 = str_replace(".", "", $var1);

Question#3 If I use the php code could the result $var1 be used in a comparison to see which number stored in $var2 is greater using a if comparison condition?

Q1. is the string embedded in text or standalone, i.e., how does it appear in the input? php preg_whatever() uses PCRE.

Q2. use bash. Invoking an external command adds overhead.
The same concept applies in php, use the library module: str_replace().

Q3. Do not use number comparisons until you have stripped the dots out of the text.
1.2.3 is NOT a number and will throw an error. You can use string comparison on "1.2.3" if you want.

Q1. Numbers would be in URL's like Release SCAP Security Guide 0.1.23 Release Notes * OpenSCAP/scap-security-guide * GitHub

Q1. Seems like I can do it in bash or php. But since main part of program is in shell I will do it there.

Q3. In shell/php can I do a conditional check on "1.2.3" and "1.2.4" o see which is greater in an if statement?

---------- Post updated at 12:28 PM ---------- Previous update was at 11:51 AM ----------

In my last reply to you, I just posted the URL but the forum seems to have resolved it. Should have seen that parse link option. I would be performing the REGEX on Release SCAP Security Guide 0.1.23 Release Notes · ComplianceAsCode/content · GitHub