I'm working on perl to capture this this part of the HTML file so for example:
I'm using this regex ([0-9]{4}).([0-9]{4}) to capture this 1910.1024. But some portion of the HTML file have this kind of value 1910.1024(a)(2). I don't know the proper way to captured this two parentheses with a value inside it. I will be using this regex to my Perl script to substitute this a link.
My script now is capturing this value 1910.1024, I want to know on how to captured this 1910.1024(a)(2) one.
if($content =~ m/([0-9]{4}).([0-9]{4})/gm){
$content =~ s/([0-9]{4}).([0-9]{4})/<!!uf dp_ecfr29 29cfr$1x$2 #29cfr$1x$2>$1.$2<\/a>/gm;
}
elsif($content2 =~ m/([0-9]{4})\.([0-9]{4})(?:\((\w+)\))?(?:\((\w+)\))/gm){
$content2 =~ s~([0-9]{4})\.([0-9]{4})(?:\((\w+)\))?(?:\((\w+)\))?~<!!uf dp_ecfr29 29cfr$1x$2 #29cfr$1x$2z-$3-$4>$1.$2($3)($4)</a>~g;
}
elsif($content3 =~ m/([0-9]{4})\.([0-9]{4})(?:\((\w+)\))/gm){
$content3 =~ s~([0-9]{4})\.([0-9]{4})(?:\((\w+)\))?~<!!uf dp_ecfr29 29cfr$1x$2 #29cfr$1x$2z-$3>$1.$2($3)</a>~g;
}
else {
printf "Error";
}