Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a white space in the sensor matching to prevent TempSpare10 from m... #486

Merged
merged 1 commit into from
Mar 2, 2015

Conversation

hplato
Copy link
Collaborator

@hplato hplato commented Feb 17, 2015

Added in a whitespace check, sensor was matching both TempSpare10 and TempSpare1.

…m matching TempSpare1

	modified:   AnalogSensor_Item.pm
@hollie
Copy link
Owner

hollie commented Feb 18, 2015

Hello @hplato,

thanks for the bug fix. I wonder: you state in your comment you added a whitespace in the matching, but as far as I see you added a \W to the regular expression. This is a match on a non-word character.

Would it be not safer to change the regular expression to

$sensor_names !~ /$rrd_ref$/i

This way the regular expression only matches on the complete value of $rrd_ref.

Note: I did not test this out, I have no codebase where I can verify this on.

Kind regards,
Lieven.

@hplato
Copy link
Collaborator Author

hplato commented Feb 18, 2015

I had a issue with sensor both matching TempSpare1 and TempSpare10. I believe this regex matches against a long string of rrd sensor names, so hence the match against a word. It works for me.

I fixed this a while back when working with Dan on the rrd shading issue, so i've forgotten most of the details around this.

Thanks for the QA!

Sent from my mobile device.

On Feb 18, 2015, at 1:15 AM, Lieven Hollevoet [email protected] wrote:

Hello @hplato,

thanks for the bug fix. I wonder: you state in your comment you added a whitespace in the matching, but as far as I see you added a \W to the regular expression. This is a match on a non-word character.

Would it be not safer to change the regular expression to

$sensor_names !~ /$rrd_ref$/i
This way the regular expression only matches on the complete value of $rrd_ref.

Note: I did not test this out, I have no codebase where I can verify this on.

Kind regards,
Lieven.


Reply to this email directly or view it on GitHub.

hollie added a commit that referenced this pull request Mar 2, 2015
Added a white space in the sensor matching to prevent TempSpare10 from m...
@hollie hollie merged commit 06ef5c8 into hollie:master Mar 2, 2015
@hollie
Copy link
Owner

hollie commented Mar 2, 2015

Hey @hplato,

thanks for the feedback. Merged!

Regards,
Lieven.

@hplato hplato deleted the analog_sensor branch May 11, 2015 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants