Post History
JavaScript (Node.js), 91 68 65 bytes s=>s.toUpperCase().match(/(?<=^| )[A-Z]|:|;|(?<=[.?!]) /g).join`` Assumes that the original text is properly formatted (has a space after punctuati...
Answer
#3: Post edited
# [JavaScript (Node.js)], ~~91~~ 68 bytes- ```javascript
s=>s.toUpperCase().match(/(?<=^| )[A-Z]|[:;]|(?<=[.?!]) /g).join('')- ```
- Assumes that the original text is properly formatted (has a space after punctuation). It converts the string to uppercase, then matches the following:
- - A letter at the beginning of the string or preceded by a space
- - `:` or `;`
- - A space preceded by `.`, `?`, or `!`
- [Try it online!][TIO-ktf9hotk]
- [JavaScript (Node.js)]: https://nodejs.org
[TIO-ktf9hotk]: https://tio.run/##RY9Bb4JAEIXP8isGYyKbAJ4tRdJ4aL23MSmhcWEHWbvukN21xqi/nbr00ON830vmvQP/4bYxsneJJoFDmw82X9nU0Uffo1lzixFLj9w1XbSIiuf86wasfEk@q1v5lFU3j8q0CCsGiz1LDyR1NJ@zoSFtHTi0zkIOZTCZvqFSFMOWjBLhNH6QNddwoRMc@TfCEYGD5VqcZdMVo@8ujwaJxpMzUtOI3olAkd5nIKTQcwcGuRjNBqw7CYkiBkHenMmYSwobOEuloOfWpmNw23FXFEVY/JV4Red/L5dQk3MKLVALNaKJoTYUToMqC4KWDET/k3xknMbgGkw8J4Wpon20m129uEOygtm1jfzB7juWBffhFw "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~91~~ ~~68~~ 65 bytes
- ```javascript
- s=>s.toUpperCase().match(/(?<=^| )[A-Z]|:|;|(?<=[.?!]) /g).join``
- ```
- Assumes that the original text is properly formatted (has a space after punctuation). It converts the string to uppercase, then matches the following:
- - A letter at the beginning of the string or preceded by a space
- - `:` or `;`
- - A space preceded by `.`, `?`, or `!`
- [Try it online!][TIO-ktf9hotk]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-ktf9hotk]: https://tio.run/##RY/BbsIwEETPzVdsEFJjKQlnmgar4tByb4VURBUTb4ip8Ua2KUKEb09xeuhx3xtpdg7iR7jaqs5nhiQOTTm4cuFyTx9dh3YpHCYsPwpft8ks4c/lVw9s85J9bvunvugD2eQ83jKY7Vl@IGWqaqjJOA8enXdQwiZ6mLyh1pTCmqyW8SS9k6UwcKETHMU3whFBgBNGnlXd8tG3l3t9ZvDkrTI0onci0GT2BUglzaMHi0KOZgXOn6RCmYKkYM5k7SWHFZyV1tAJ5/IxuG6F55zH/O@JV/Shez6HHXmv0QE1sEO0KewsxZNoW0RRQxaS/0khMk5jcI0eAieNuaZ9Uk2vQdwgW8D02iThYLeKFdFt@AU "JavaScript (Node.js) – Try It Online"
#2: Post edited
# [JavaScript (Node.js)], 91 bytes- ```
s=>s.replace(/[^ .;]+ ?/g,m=>m[0]).replace(/[ \d]/g,'').replace(/[.?!]/g,' ').toUpperCase()```- [Try it online!][TIO-ktf9hotk]
Stupid regex replacement abuse which probably isn't very golfy.- [JavaScript (Node.js)]: https://nodejs.org
[TIO-ktf9hotk]: https://tio.run/##TY9Bb4JAEIXP8isexkRIEXs1BDl4aL238WBpXNhBaZcdsrvWGONvp0AP9Tjf9zIz70v8CFuaunULzZK6Ku1suraxoVaJkoLl/hNxkj8hWx6jJl03@@c8fLD4kHlv5vNHGGf@CNFTx@9tS2YjLAVhV7K2Do6ss0ix9ybTV1KKI@zYKOlPo55shMaVz2jEN6EhCFih5aUuT9noT9d@30LT2Zla84jemKFYHxPIWuq5gyEhR7OFdWdZk4wgeTAXNuYaY4tLrRRaYW08Bncn4bIs87O/J17IDbdXKxTsnCILrlAQmQiFYX/q5YnnVWwQ/FcaImO1EDdvMnBWFCs@BofZbRB3LNaY3apgGML7IUy8e/cL "JavaScript (Node.js) – Try It Online"
- # [JavaScript (Node.js)], ~~91~~ 68 bytes
- ```javascript
- s=>s.toUpperCase().match(/(?<=^| )[A-Z]|[:;]|(?<=[.?!]) /g).join('')
- ```
- Assumes that the original text is properly formatted (has a space after punctuation). It converts the string to uppercase, then matches the following:
- - A letter at the beginning of the string or preceded by a space
- - `:` or `;`
- - A space preceded by `.`, `?`, or `!`
- [Try it online!][TIO-ktf9hotk]
- [JavaScript (Node.js)]: https://nodejs.org
- [TIO-ktf9hotk]: https://tio.run/##RY9Bb4JAEIXP8isGYyKbAJ4tRdJ4aL23MSmhcWEHWbvukN21xqi/nbr00ON830vmvQP/4bYxsneJJoFDmw82X9nU0Uffo1lzixFLj9w1XbSIiuf86wasfEk@q1v5lFU3j8q0CCsGiz1LDyR1NJ@zoSFtHTi0zkIOZTCZvqFSFMOWjBLhNH6QNddwoRMc@TfCEYGD5VqcZdMVo@8ujwaJxpMzUtOI3olAkd5nIKTQcwcGuRjNBqw7CYkiBkHenMmYSwobOEuloOfWpmNw23FXFEVY/JV4Red/L5dQk3MKLVALNaKJoTYUToMqC4KWDET/k3xknMbgGkw8J4Wpon20m129uEOygtm1jfzB7juWBffhFw "JavaScript (Node.js) – Try It Online"
#1: Initial revision
# [JavaScript (Node.js)], 91 bytes ``` s=>s.replace(/[^ .;]+ ?/g,m=>m[0]).replace(/[ \d]/g,'').replace(/[.?!]/g,' ').toUpperCase() ``` [Try it online!][TIO-ktf9hotk] Stupid regex replacement abuse which probably isn't very golfy. [JavaScript (Node.js)]: https://nodejs.org [TIO-ktf9hotk]: https://tio.run/##TY9Bb4JAEIXP8isexkRIEXs1BDl4aL238WBpXNhBaZcdsrvWGONvp0AP9Tjf9zIz70v8CFuaunULzZK6Ku1suraxoVaJkoLl/hNxkj8hWx6jJl03@@c8fLD4kHlv5vNHGGf@CNFTx@9tS2YjLAVhV7K2Do6ss0ix9ybTV1KKI@zYKOlPo55shMaVz2jEN6EhCFih5aUuT9noT9d@30LT2Zla84jemKFYHxPIWuq5gyEhR7OFdWdZk4wgeTAXNuYaY4tLrRRaYW08Bncn4bIs87O/J17IDbdXKxTsnCILrlAQmQiFYX/q5YnnVWwQ/FcaImO1EDdvMnBWFCs@BofZbRB3LNaY3apgGML7IUy8e/cL "JavaScript (Node.js) – Try It Online"