Post History
JavaScript (Node.js), 101 82 bytes -19 bytes thanks to Shaggy! x=>x.replace(/(..)\1{0,62}/g,(c,g)=>c>'c'||c[5]?(192+c.length/2).toString(16)+g:c) Try it online! Everything can be sol...
Answer
#2: Post edited
# [JavaScript (Node.js)], 101 bytes- ```javascript
x=>x.match(/(..)\1{0,62}/g).map(c=>c>'c'|c.length>5?(192+c.length/2).toString(16)+c[0]+c[1]:c).join``- ```
- [Try it online!][TIO-kug951yh]
- Everything can be solved with regexes.
- Takes input and outputs as hex strings.
- [JavaScript (Node.js)]: https://nodejs.org
[TIO-kug951yh]: https://tio.run/##zZRBTsMwEEXX9Sm8s620zthAJUAJh2DZRmo62GmqYFeJhSqVnj0EBwQ3qP9iNPP@5q3mWH/UA/btKaycfzOjLcZzUZ7lex3wwHMupdiqCyzX@po3YsInjkWJJUP2ibIzrgmH8uGFq0ed/d65FjL419C3ruFqLTLcQDUNVT2hkEffut1uRO@GQIMZwkALuiELBgAKNNzBPVvOJ0SkACLYm71FQIX6f3@jJKCQiEQyGj8i9qZJQCERiWQ0okj1TIj1PeV/f4d6O/8fQS9k8c19Z2TnGx7bjLKto6uSsmm1kYkZMkGu4xc "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~101~~ 82 bytes
- *-19 bytes thanks to Shaggy!*
- ```javascript
- x=>x.replace(/(..)\1{0,62}/g,(c,g)=>c>'c'||c[5]?(192+c.length/2).toString(16)+g:c)
- ```
- [Try it online!][TIO-kug951yh]
- Everything can be solved with regexes.
- Takes input and outputs as hex strings.
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-kug951yh]: https://tio.run/##zZRBbsIwEEXX@BTe2VaCM3ZbJFolHKJLYBGmtguKbJRYCAk4ewpOpfYG@K9m3t@81T@0p3bAfn@Mcx@@zGjr8Vw3Z9mbY9ei4RWXUmzUBcqFvlWu5Fg6UTfYMGTXK67ftiuulrpA2Rnv4nelhYzhM/Z777haiMK9oxgx@CHSaIY40JquyYwBgAINL/DKyumFhBRAAjuzswioUP/vn5QMFDKRyEbjV8Q@NRkoZCKRjUYS2X4QYkNP@d/u0GCn/RH0QmYPHjoju@B4agvKNp7OG8rup01MTJAJcht/AA "JavaScript (Node.js) – Try It Online"
#1: Initial revision
# [JavaScript (Node.js)], 101 bytes ```javascript x=>x.match(/(..)\1{0,62}/g).map(c=>c>'c'|c.length>5?(192+c.length/2).toString(16)+c[0]+c[1]:c).join`` ``` [Try it online!][TIO-kug951yh] Everything can be solved with regexes. Takes input and outputs as hex strings. [JavaScript (Node.js)]: https://nodejs.org [TIO-kug951yh]: https://tio.run/##zZRBTsMwEEXX9Sm8s620zthAJUAJh2DZRmo62GmqYFeJhSqVnj0EBwQ3qP9iNPP@5q3mWH/UA/btKaycfzOjLcZzUZ7lex3wwHMupdiqCyzX@po3YsInjkWJJUP2ibIzrgmH8uGFq0ed/d65FjL419C3ruFqLTLcQDUNVT2hkEffut1uRO@GQIMZwkALuiELBgAKNNzBPVvOJ0SkACLYm71FQIX6f3@jJKCQiEQyGj8i9qZJQCERiWQ0okj1TIj1PeV/f4d6O/8fQS9k8c19Z2TnGx7bjLKto6uSsmm1kYkZMkGu4xc "JavaScript (Node.js) – Try It Online"