Menu

Plotdata Capture with Regex

Logging
Anonymous
2021-03-13
2021-03-18
  • Anonymous

    Anonymous - 2021-03-13

    My device outputs lines like below

    79.2%(79.2%), V=4072mV, I=5mA, T=39.0C, ChVal=1425, RemTime=123
    

    I was wondering if /(?<=ChVal\=)(\d+)/g kinda regex would capture my ChVal value and plot it (well that regex didn't work for sure). Otherwise can someone explain how plotdata is sourced from the filter?

     
    • Maettu

      Maettu - 2021-03-17

      The regex can be simplified to ChVal=(\d+). While this may not be good enough for other cases, it should be good enough for this particular case.

      Note that YAT uses the .NET regex flavour, matched by http://regexstorm.net/tester. But that site is quite limited in features. So I only use it to verify .NET compatibility. I prefer using https://regex101.com/, alternatively https://regexr.com/ which works fine as well.

      See attached screenshot how I could successfully plot using this regex.

       
      ❤️
      1
  • Alp Sayin

    Alp Sayin - 2021-03-18

    Beautiful. Thank you so much! Oh this is gonna make live battery life / voltage fluctuation measurements incredible.

     

Anonymous
Anonymous

Add attachments
Cancel