Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
390974b8f3 | |||
|
3514c4df4e | ||
|
101754cc43 |
13 changed files with 3101 additions and 0 deletions
30
.gitignore
vendored
Normal file
30
.gitignore
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
coverage
|
||||||
|
*.local
|
||||||
|
|
||||||
|
/cypress/videos/
|
||||||
|
/cypress/screenshots/
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
*.tsbuildinfo
|
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"recommendations": ["Vue.volar"]
|
||||||
|
}
|
20
Notes.md
Normal file
20
Notes.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
Rule 1:
|
||||||
|
Strings can be simly matched by setting them as a regex Rule
|
||||||
|
Rule 2:
|
||||||
|
Dots represent any number of any Character
|
||||||
|
Rule 3:
|
||||||
|
Put characters in square brackets to match any of them
|
||||||
|
Rule 4:
|
||||||
|
Put a rage of numbers like inside square brackets with a dash in between to match a range
|
||||||
|
Rule 5:
|
||||||
|
Use an asterix to match any emount of a specific character
|
||||||
|
Rule 6:
|
||||||
|
Use a plus sign to match a specific character if it exists one more more times
|
||||||
|
Rule 7:
|
||||||
|
Use a questionmark to match a character that could exists optionally
|
||||||
|
Rule 8:
|
||||||
|
To match a specific amount of a specific character use curly braces
|
||||||
|
Rule 9:
|
||||||
|
To match a specific amount or a higher amount of a specific character use curly braces with a comma
|
||||||
|
Rule 10:
|
||||||
|
To match a number of characters of a specific range of a character use curly curly braces with a the range and a comma in between
|
13
index.html
Normal file
13
index.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="icon" href="/favicon.ico">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Vite App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
8
jsconfig.json
Normal file
8
jsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules", "dist"]
|
||||||
|
}
|
2807
package-lock.json
generated
Normal file
2807
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
21
package.json
Normal file
21
package.json
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "regex-vue",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"pinia": "^3.0.1",
|
||||||
|
"vue": "^3.5.13",
|
||||||
|
"vue-router": "^4.5.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
"vite": "^6.2.1",
|
||||||
|
"vite-plugin-vue-devtools": "^7.7.2"
|
||||||
|
}
|
||||||
|
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
139
src/App.vue
Normal file
139
src/App.vue
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
<script setup>
|
||||||
|
import Rule from '@/components/Rule.vue'
|
||||||
|
import { reactive, computed, ref } from 'vue'
|
||||||
|
|
||||||
|
let currentRule = ref(0)
|
||||||
|
let lang = ref(true)
|
||||||
|
|
||||||
|
const toggleLang = () => {
|
||||||
|
lang.value = !lang.value
|
||||||
|
}
|
||||||
|
|
||||||
|
const availableRules = computed(() => {
|
||||||
|
console.log("Rule update:", rules);
|
||||||
|
return rules.map(rule => {
|
||||||
|
if (lang.value) {
|
||||||
|
rule.name = rule.engname
|
||||||
|
rule.description = rule.engdescription
|
||||||
|
} else {
|
||||||
|
rule.name = rule.gername
|
||||||
|
rule.description = rule.gerdescription
|
||||||
|
}
|
||||||
|
return rule;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
let rules = reactive([
|
||||||
|
{
|
||||||
|
"engname": "String match with regex rule",
|
||||||
|
"engdescription": "Use strings as regex to match exact text patterns.",
|
||||||
|
"gername": "Zeichenkette als Regex-Regel",
|
||||||
|
"gerdescription": "Nutze Strings als regex um exakte Strings zu finden.",
|
||||||
|
"id": 0,
|
||||||
|
"examples": ["hello", "world"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Dots match any character",
|
||||||
|
"engdescription": "Use a dot to match any single character except newline characters.",
|
||||||
|
"gername": "Punkte als Platzhalter",
|
||||||
|
"gerdescription": "Nutze einen Punkt (.) um ein beliebiges einzelnen Zeichen abgesehen von Zeilenumbrüchen zu matchen.",
|
||||||
|
"id": 1,
|
||||||
|
"examples": ["h.t", "a.c"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Square brackets for multiple characters",
|
||||||
|
"engdescription": "Use square brackets to match any characters in them.",
|
||||||
|
"gername": "Eckige Klammern für mehrere Klassen",
|
||||||
|
"gerdescription": "Nutze eckige Klammern um jegliches Zeichen in diesen zu matchen.",
|
||||||
|
"id": 2,
|
||||||
|
"examples": ["[abc]", "[123]"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Square brackets for range",
|
||||||
|
"engdescription": "Use square brackets with a dash [-] to specify a range of characters or numbers.",
|
||||||
|
"gername": "Bereich mit eckigen Klammern",
|
||||||
|
"gerdescription": "Nutze einen Strich [-] um einen Bereich von Zeichen oder Zahlen zu matchen.",
|
||||||
|
"id": 3,
|
||||||
|
"examples": ["[a-z]", "[0-9]"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Stars for zero or multiple characters",
|
||||||
|
"engdescription": "Use stars (*) to matches zero or more occurrences of a specific character.",
|
||||||
|
"gername": "Sternchen für null oder mehrere Zeichen",
|
||||||
|
"gerdescription": "Nutze einen Stern (*) um null oder mehreren malen eines bestimmten Zeichen zu matchen.",
|
||||||
|
"id": 4,
|
||||||
|
"examples": ["a*", "b*"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Plus sign for one or more characters",
|
||||||
|
"engdescription": "Use pluses (+) to match one or more occurrences of a specific character.",
|
||||||
|
"gername": "Pluszeichen für ein oder mehr Zeichen",
|
||||||
|
"gerdescription": "Nutze das Plus (+) um einem oder mehreren malen eines bestimmten Zeichen zu matchen.",
|
||||||
|
"id": 5,
|
||||||
|
"examples": ["a+", "1+"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Question mark for optional character",
|
||||||
|
"engdescription": "Use the question mark (?) matches zero or one occurrence of a specific character.",
|
||||||
|
"gername": "Fragezeichen für optionales Zeichen",
|
||||||
|
"gerdescription": "Nutze das Fragezeichen (?) um null oder einem Vorkommen eines bestimmten Zeichens zu matchen.",
|
||||||
|
"id": 6,
|
||||||
|
"examples": ["a?", "b?"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Curly braces for exact amount",
|
||||||
|
"engdescription": "Curly braces {} are used to specify the exact number of occurrences of a character.",
|
||||||
|
"gername": "Geschweifte Klammern für genaue Anzahl",
|
||||||
|
"gerdescription": "Nutze geschweifte Klammern {} um die genaue Anzahl eines Zeichens zu matchen.",
|
||||||
|
"id": 7,
|
||||||
|
"examples": ["a{3}", "b{2}"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Curly braces for minimum amount",
|
||||||
|
"engdescription": "User curly braces with a comma {n,} to match at least 'n' occurrences of a specific characters.",
|
||||||
|
"gername": "Mindestens Anzahl mit geschweiften Klammern",
|
||||||
|
"gerdescription": "Nutze geschweifte Klammern mit einem Komma {n,} um mindestens 'n' Anzahl eines bestimmten Zeichens zu matchen.",
|
||||||
|
"id": 8,
|
||||||
|
"examples": ["a{2,}", "1{3,}"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"engname": "Curly braces for range",
|
||||||
|
"engdescription": "User curly braces with a range {n,m} match between 'n' and 'm' occurrences of a specific character.",
|
||||||
|
"gername": "Bereich mit geschweiften Klammern",
|
||||||
|
"gerdescription": "Nutze geschweifte Klammern mit einem Bereich {n,m} um zwischen 'n' und 'm' Anzahl eines bestimmten Zeichens zu matchen.",
|
||||||
|
"id": 9,
|
||||||
|
"examples": ["a{2,4}", "b{1,3}"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<select name="RuleSelector" id="RuleSelector" v-model="currentRule">
|
||||||
|
<option v-for="rule in availableRules" :key="rule.id" :value="rule.id">
|
||||||
|
{{ rule.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<Rule :currentRule="currentRule" :rules="rules" />
|
||||||
|
<br>
|
||||||
|
<button @click="toggleLang">{{ lang ? "Toggele Sprache" : "Toggle language" }}</button>
|
||||||
|
<p>Credits: <a href="https://regexone.com/">https://regexone.com/</a></p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #002626;
|
||||||
|
}
|
||||||
|
p, h3 {
|
||||||
|
color: #EFE7DA;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
color: #95C623
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
19
src/components/Rule.vue
Normal file
19
src/components/Rule.vue
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
const props = defineProps ({
|
||||||
|
rules: Array,
|
||||||
|
currentRule: Number,
|
||||||
|
})
|
||||||
|
|
||||||
|
const currentRuleObj = computed(() => {
|
||||||
|
return props.rules.find(rule => rule.id === props.currentRule)
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<h2>Rule: {{ currentRuleObj.name }}</h2>
|
||||||
|
<p> {{ currentRuleObj.description }} </p>
|
||||||
|
<h3>Examples:</h3>
|
||||||
|
<p v-for="example in currentRuleObj.examples"> {{ example }}</p>
|
||||||
|
</template>
|
12
src/main.js
Normal file
12
src/main.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { createApp } from 'vue'
|
||||||
|
import { createPinia } from 'pinia'
|
||||||
|
|
||||||
|
import App from './App.vue'
|
||||||
|
import router from './router'
|
||||||
|
|
||||||
|
const app = createApp(App)
|
||||||
|
|
||||||
|
app.use(createPinia())
|
||||||
|
app.use(router)
|
||||||
|
|
||||||
|
app.mount('#app')
|
11
src/router/index.js
Normal file
11
src/router/index.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
|
// import HomeView from '../views/HomeView.vue'
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
routes: [
|
||||||
|
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
export default router
|
18
vite.config.js
Normal file
18
vite.config.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
vueDevTools(),
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
Loading…
Add table
Reference in a new issue