A better version of regex 101
need builder to not make groups for everything
2 files changed, +4 -5
+3-4src/App.jsx
| @@ -24,9 +24,9 @@ function App() { | ||
| 24 | 24 | ); |
| 25 | 25 | const builder = ( |
| 26 | 26 | <textarea |
| 27 | - rows="10" | |
| 27 | + rows="20" | |
| 28 | 28 | className={ |
| 29 | - "w-full p-2 rounded-sm font-re101-input text-input" + | |
| 29 | + "w-full p-2 rounded-sm font-re101-input text-input decoration-slate-500 underline" + | |
| 30 | 30 | (valid ? "" : " text-red-500") |
| 31 | 31 | } |
| 32 | 32 | placeholder={placeholder} |
| @@ -46,7 +46,7 @@ function App() { | ||
| 46 | 46 | break; |
| 47 | 47 | } |
| 48 | 48 | if (e.ctrlKey && e.key == "s") { |
| 49 | - console.log("save"); | |
| 49 | + saveBuild(); | |
| 50 | 50 | } |
| 51 | 51 | }} |
| 52 | 52 | onChangeCapture={(e) => { |
| @@ -58,7 +58,6 @@ function App() { | ||
| 58 | 58 | setTimeout( |
| 59 | 59 | () => |
| 60 | 60 | setEdited((old) => { |
| 61 | - console.log(old); | |
| 62 | 61 | return old - 1; |
| 63 | 62 | }), |
| 64 | 63 | 1000 |
+1-1src/builder.js
| @@ -32,7 +32,7 @@ const buildToRegexRecursion = (build, re) => { | ||
| 32 | 32 | if (val.name) re += `(?P<${val.name}>${val.regex}`; |
| 33 | 33 | else re += `(?:${val.regex}`; |
| 34 | 34 | if (val.children) re += buildToRegexRecursion(val.children, ""); |
| 35 | - re += `${val.optional})`; | |
| 35 | + re += `)${val.optional}`; | |
| 36 | 36 | |
| 37 | 37 | return buildToRegexRecursion(build, re); |
| 38 | 38 | }; |