Post History
JavaScript, 149 bytes t=>t.match(/CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX/) Simple regex. Retu...
Answer
#3: Post edited
# JavaScript (V8), 149 bytes- ```
- t=>t.match(/CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX/)
- ```
- Simple regex. Returns `null` on valid strings.
- [Try it online!][TIO-lwklk18h]
- [JavaScript (V8)]: https://v8.dev/
- [TIO-lwklk18h]: https://tio.run/##RVI9b0IxDNz7K94GSC2slRBd7CWSvUaWnhgQgn6oLagvYsp/fz3HQXiwHefu4jj5OtwO0/Hv81pebq/zeTeX3VtZ/xzK8WO5IVglGln3lXQkjxxL5spaE2qCVYLBjdmQZ6Q2UhJfSUcIKrKvCqu51Xw3B8X8DFHPuJpYNa0WBINtVvPx8juVoZymMg27YVykxfOwyO7Mnbgjd@xO3aXABChQAQtcADsyoBHQfxRzoFOEvrIIXYkicIS7WGOocESzOJBSamQlv1NkMIvjVMWod4AZkRp1uCoDJuDku7QTTXJoqPOibPxAMAQecGXQYxJxA5EWUWbVfjdmThqDyUKWsillk2g/S8KLol3LKn20eDNMC61xiPld1VEq0kXRE7QgLXjXpoQmjXwfdb3PDERGwcnRALO2KnpnwjPtt0/@By7fp/X35X3ZfgK@6XV5Xq228z8 "JavaScript (V8) – Try It Online"
- # JavaScript, 149 bytes
- ```
- t=>t.match(/CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX/)
- ```
- Simple regex. Returns `null` on valid strings.
- [Try it online!][TIO-lwklk18h]
- [JavaScript (V8)]: https://v8.dev/
- [TIO-lwklk18h]: https://tio.run/##RVI9b0IxDNz7K94GSC2slRBd7CWSvUaWnhgQgn6oLagvYsp/fz3HQXiwHefu4jj5OtwO0/Hv81pebq/zeTeX3VtZ/xzK8WO5IVglGln3lXQkjxxL5spaE2qCVYLBjdmQZ6Q2UhJfSUcIKrKvCqu51Xw3B8X8DFHPuJpYNa0WBINtVvPx8juVoZymMg27YVykxfOwyO7Mnbgjd@xO3aXABChQAQtcADsyoBHQfxRzoFOEvrIIXYkicIS7WGOocESzOJBSamQlv1NkMIvjVMWod4AZkRp1uCoDJuDku7QTTXJoqPOibPxAMAQecGXQYxJxA5EWUWbVfjdmThqDyUKWsillk2g/S8KLol3LKn20eDNMC61xiPld1VEq0kXRE7QgLXjXpoQmjXwfdb3PDERGwcnRALO2KnpnwjPtt0/@By7fp/X35X3ZfgK@6XV5Xq228z8 "JavaScript (V8) – Try It Online"
#2: Post edited
- # JavaScript (V8), 149 bytes
- ```
- t=>t.match(/CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX/)
- ```
- Simple regex. Returns `null` on valid strings.
- [Try it online!][TIO-lwklk18h]
- [JavaScript (V8)]: https://v8.dev/
- [TIO-lwklk18h]: https://tio.run/##RVI9b0IxDNz7K94GSC2slRBd7CWSvUaWnhgQgn6oLagvYsp/fz3HQXiwHefu4jj5OtwO0/Hv81pebq/zeTeX3VtZ/xzK8WO5IVglGln3lXQkjxxL5spaE2qCVYLBjdmQZ6Q2UhJfSUcIKrKvCqu51Xw3B8X8DFHPuJpYNa0WBINtVvPx8juVoZymMg27YVykxfOwyO7Mnbgjd@xO3aXABChQAQtcADsyoBHQfxRzoFOEvrIIXYkicIS7WGOocESzOJBSamQlv1NkMIvjVMWod4AZkRp1uCoDJuDku7QTTXJoqPOibPxAMAQecGXQYxJxA5EWUWbVfjdmThqDyUKWsillk2g/S8KLol3LKn20eDNMC61xiPld1VEq0kXRE7QgLXjXpoQmjXwfdb3PDERGwcnRALO2KnpnwjPtt0/@By7fp/X35X3ZfgK@6XV5Xq228z8 "JavaScript (V8) – Try It Online"
The same as a Google Sheets formula (**155 bytes**):```=regexextract(A1,"CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX")```Returns an error on valid strings.
- # JavaScript (V8), 149 bytes
- ```
- t=>t.match(/CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX/)
- ```
- Simple regex. Returns `null` on valid strings.
- [Try it online!][TIO-lwklk18h]
- [JavaScript (V8)]: https://v8.dev/
- [TIO-lwklk18h]: https://tio.run/##RVI9b0IxDNz7K94GSC2slRBd7CWSvUaWnhgQgn6oLagvYsp/fz3HQXiwHefu4jj5OtwO0/Hv81pebq/zeTeX3VtZ/xzK8WO5IVglGln3lXQkjxxL5spaE2qCVYLBjdmQZ6Q2UhJfSUcIKrKvCqu51Xw3B8X8DFHPuJpYNa0WBINtVvPx8juVoZymMg27YVykxfOwyO7Mnbgjd@xO3aXABChQAQtcADsyoBHQfxRzoFOEvrIIXYkicIS7WGOocESzOJBSamQlv1NkMIvjVMWod4AZkRp1uCoDJuDku7QTTXJoqPOibPxAMAQecGXQYxJxA5EWUWbVfjdmThqDyUKWsillk2g/S8KLol3LKn20eDNMC61xiPld1VEq0kXRE7QgLXjXpoQmjXwfdb3PDERGwcnRALO2KnpnwjPtt0/@By7fp/X35X3ZfgK@6XV5Xq228z8 "JavaScript (V8) – Try It Online"
#1: Initial revision
# JavaScript (V8), 149 bytes ``` t=>t.match(/CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX/) ``` Simple regex. Returns `null` on valid strings. [Try it online!][TIO-lwklk18h] [JavaScript (V8)]: https://v8.dev/ [TIO-lwklk18h]: https://tio.run/##RVI9b0IxDNz7K94GSC2slRBd7CWSvUaWnhgQgn6oLagvYsp/fz3HQXiwHefu4jj5OtwO0/Hv81pebq/zeTeX3VtZ/xzK8WO5IVglGln3lXQkjxxL5spaE2qCVYLBjdmQZ6Q2UhJfSUcIKrKvCqu51Xw3B8X8DFHPuJpYNa0WBINtVvPx8juVoZymMg27YVykxfOwyO7Mnbgjd@xO3aXABChQAQtcADsyoBHQfxRzoFOEvrIIXYkicIS7WGOocESzOJBSamQlv1NkMIvjVMWod4AZkRp1uCoDJuDku7QTTXJoqPOibPxAMAQecGXQYxJxA5EWUWbVfjdmThqDyUKWsillk2g/S8KLol3LKn20eDNMC61xiPld1VEq0kXRE7QgLXjXpoQmjXwfdb3PDERGwcnRALO2KnpnwjPtt0/@By7fp/X35X3ZfgK@6XV5Xq228z8 "JavaScript (V8) – Try It Online" The same as a Google Sheets formula (**155 bytes**): ``` =regexextract(A1,"CCCC|CC[DM]|CM[CDM]|DC[DM]|DD|DM|I[CDLM]|IIII|II[VX]|IVI|IX[CILVX]|L[CDLM]|LX[CL]|MMMM|V[CDLMVX]|VI[VX]|XCC[DLMX]|XD|XLX|XM|XX[CL]|XXXX") ``` Returns an error on valid strings.