Activity for --Hyde
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #291538 |
Got it. Thanks for your patience. (more) |
— | 7 months ago |
Edit | Post #291538 |
Post edited: |
— | 7 months ago |
Edit | Post #291542 | Initial revision | — | 7 months ago |
Answer | — |
A: The 50 substrings that validate any string of Roman numerals Google Sheets, 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") ``` The same regex as in my JavaScript answer. Returns an error on valid strings. (more) |
— | 7 months ago |
Edit | Post #291538 |
Post edited: move Google Sheets formula to its own answer |
— | 7 months ago |
Comment | Post #291538 |
@#53890 thanks, but I don't really see the point, because the same pattern can be used as is in most any regex capable language. I wanted to show the Google Sheets formula because it uses `regexextract()` instead of the `regexmatch()` as one's knee-jerk approach would often be. First time here so I d... (more) |
— | 7 months ago |
Edit | Post #291538 | Initial revision | — | 7 months ago |
Answer | — |
A: The 50 substrings that validate any string of Roman numerals 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! (more) |
— | 7 months ago |