php正则表达式获得字符串的中间位置

I parse an html page into a plain text in order to find and get a numeric value. In the whole html mess, I need to find a string like this one:

C) Debiti33.197.431,90I - Di finanziamento

I need the number 33.197.431,90 (where this number is going to change on every html parsing request.

Is there any regex to achieve this? For example:

STARTS WITH 'C) Debiti' ENDS WITH 'I - Di finanziamento' GETS the middle string that can be whatever.

Whenever I try, I get empty results...don't know that much about regex. Can you please help me? Thank you very much.

You could try the below regex,

^C\) Debiti\K.*?(?=I - Di finanziamento$)

DEMO

PHP code would be,

<?php
$mystring = "C) Debiti33.197.431,90I - Di finanziamento";
$regex = '~^C\) Debiti\K.*?(?=I - Di finanziamento$)~';
if (preg_match($regex, $mystring, $m)) {
    $yourmatch = $m[0]; 
    echo $yourmatch;
    }
?> //=> 33.197.431,90

This should work. Read section Want to Be Lazy? Think Twice.

(?<=\bC\) Debiti)[\d.,]+(?=I - Di finanziamento\b)

Here is demo

sample code:

$re = "/(?<=\\bC\\) Debiti)[\\d.,]+(?=I - Di finanziamento\\b)/i";
$str = "C) Debiti33.197.431,90I - Di finanziamento";

preg_match($re, $str, $matches);