Regex - Beginner need help

Hi, i need ur help. im new with regex and i cant get the right string i need…
I have a xml-file with many temperatures and want only one temperature of them.

here is the sample xml-file

 <sensor107>
  <name>sample1</name>
  <value_float>39.31</value_float>
  <value_int>3931</value_int>
  <value_string>39.31</value_string>
  <min_abs_float>37.11</min_abs_float>
  <max_abs_float>44.16</max_abs_float>
  <min_day_float>38.36</min_day_float>
  <max_day_float>40.81</max_day_float>
  <unit>%</unit>
  <value_display>39.31 %</value_display>
 </sensor107>
 <sensor108>
  <name>sample2</name>
  <value_float>1085.47</value_float>
  <value_int>108546</value_int>
  <value_string>1085.47</value_string>
  <min_abs_float>1082.63</min_abs_float>
  <max_abs_float>1086.42</max_abs_float>
  <min_day_float>1082.63</min_day_float>
  <max_day_float>1086.42</max_day_float>
  <unit>hPa</unit>
  <value_display>1085.47 hPa</value_display>
 </sensor108>
 <sensor109>
  <name>sample3</name>
  <value_float>17.40</value_float>
  <value_int>1739</value_int>
  <value_string>17.40</value_string>
  <min_abs_float>16.95</min_abs_float>
  <max_abs_float>19.04</max_abs_float>
  <min_day_float>17.20</min_day_float>
  <max_day_float>17.87</max_day_float>
  <unit>°C</unit>
  <value_display>17.40 °C</value_display>
 </sensor109>
 <sensor110>
  <name>sample4</name>
  <value_float>36.06</value_float>
  <value_int>3606</value_int>
  <value_string>36.06</value_string>
  <min_abs_float>33.96</min_abs_float>
  <max_abs_float>44.93</max_abs_float>
  <min_day_float>33.96</min_day_float>
  <max_day_float>39.72</max_day_float>
  <unit>%</unit>
  <value_display>36.06 %</value_display>
 </sensor110>
 <sensor111>
  <name>sample5</name>
  <value_float>1086.10</value_float>
  <value_int>108609</value_int>
  <value_string>1086.10</value_string>
  <min_abs_float>1083.89</min_abs_float>
  <max_abs_float>1086.73</max_abs_float>
  <min_day_float>1083.89</min_day_float>
  <max_day_float>1086.42</max_day_float>
  <unit>hPa</unit>
  <value_display>1086.10 hPa</value_display>
 </sensor111>

Now i only need the temp of the sample4 “value_float”.

With (.*?<value_float>(.*?)</value_float>.*) i didnt get the right value.
With (.*?<name>sample4</name>(.*?)</value_float>.*) i get the rigth temp, but with <value_float> infront of it.

plz…need help.
THX

What about

(.*?<name>sample4</name><value_float>(.*?)</value_float>.*)

Not sure if it works, but worth a try.

nope…that result is null
because there is a tab and a line break…i think thhats thhe prob

Or even more simple

<name>sample4</name>.*?<value_float>(.*?)</value_float>

thats null again…

Without more context it is hard to answer, however, the regex itself should be fine - please find attached screenshot below:

Which group are you expecting your result to be in?

Did You just copy @crnjan’s example or did you change it to

(.*?<name>sample4</name>.*?<value_float>(.*?)</value_float>.*)

thx…now it works…last post was the right string to get the infos i want…

Here’s a nice little website for regex testing. Maybe interesting for the next regex challenge.