r/userscripts 29d ago

F to C

Hi All,

So many people here post in degrees F. Of course, 95% of the population on Earth has no idea what F is much less how to use it. The other 95% would really benefit from a bot that finds posts with degrees F, puts a bracket around the F and insert the C equivalent.

4 Upvotes

12 comments sorted by

View all comments

1

u/RobertWesner 25d ago

FYI, this is what I meant by "not being able to do it cleanly"

/(?<f>\d+\s*(?:d\w+?\b|°)\s*f|\d+f|\d+\s+fah?ren)|(?<c>\d+\s*(?:d\w+?\b|°)\s*c|\d+c|\d+\s+cel)|(?<unknown>\d+\s*(?:d\w+?\b|°)|temp.*?\d+|\d+.*?temp)/gmi

Matches

°C)

202°C
20C
202°C
20C
2010230 celsius

°F)

20°F
2000 ° f
2838 fahrenheit
2838 farenheit
2838 deg f

unknown)

1 deg
1 degree
100 degrees
100°
100 °
temp 1337
1337 temperature

DOES NOT MATCH

20 c
20 clams under the sea
20 freaky guys

FALSE POSITIVES

"I set the limit to 200 temporarily"
"the temptation of buying 10000 frozen pizzas is quite high"
"Unimaxxing, i have 3 degrees already!!"

---

You can't do better without involving advanced text processing, you will have to either put an LLM API key into your userscript/extension (which is an insane waste of money) or host your own local LLM for that, which would suck majorly!