A better version of regex 101
now the variable builder can update
1 file changed, +12 -0
+12-0src/App.jsx
| @@ -19,6 +19,7 @@ function App() { | ||
| 19 | 19 | const [hideVariables, setHideVariables] = useState(false); |
| 20 | 20 | const [hideBuilder, setHideBuilder] = useState(false); |
| 21 | 21 | const [varText, setVarText] = useState(""); |
| 22 | + const [builderText, setBuilderText] = useState(""); | |
| 22 | 23 | const regexInput = document.querySelector( |
| 23 | 24 | "#regex-app > div > div.QtZzw > div > div.AUc0W > div.rjodX > div.cO83v > div.h9z_E.T886D > div > div > div:nth-child(1) > textarea" |
| 24 | 25 | ); |
| @@ -47,6 +48,16 @@ function App() { | ||
| 47 | 48 | className="w-full" |
| 48 | 49 | onChange={(e) => { |
| 49 | 50 | setVarText(e.target.value); |
| 51 | + const parsedVars = readVars(e.target.value); | |
| 52 | + const parseBuild = parseBuilder(builderText, parsedVars); | |
| 53 | + if (!parseBuild) setValid(false); | |
| 54 | + else setValid(true); | |
| 55 | + setBuild(parseBuild); | |
| 56 | + }} | |
| 57 | + onKeyDown={(e) => { | |
| 58 | + if (e.ctrlKey && e.key == "s") { | |
| 59 | + saveBuild(); | |
| 60 | + } | |
| 50 | 61 | }} |
| 51 | 62 | ></textarea> |
| 52 | 63 | {hideButton(setHideVariables, hideVariables)} |
| @@ -82,6 +93,7 @@ function App() { | ||
| 82 | 93 | }} |
| 83 | 94 | onChangeCapture={(e) => { |
| 84 | 95 | const parsedVars = readVars(varText); |
| 96 | + setBuilderText(e.target.value); | |
| 85 | 97 | const parseBuild = parseBuilder(e.target.value, parsedVars); |
| 86 | 98 | if (!parseBuild) setValid(false); |
| 87 | 99 | else setValid(true); |