Skip to content

Commit b0d6e42

Browse files
committed
regexing for jezybus
1 parent 72ca3bc commit b0d6e42

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

RegEx/readme.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## creating fake data quickly
2+
3+
you want to turn this
4+
5+
```
6+
JEB JIBBLY 1234 3
7+
BOBBY TABLES 2314 1
8+
WHISKY JACK 2241 2
9+
```
10+
11+
into this
12+
13+
```
14+
WITH FOO AS
15+
( SELECT 'JEB JIBBLY' "FULL_NAME", '1234' "PIN", '3' "FAILED_ATTEMPTS" FROM DUAL
16+
UNION ALL
17+
SELECT 'BOBBY TABLES' "FULL_NAME", '2314' "PIN", '1' "FAILED_ATTEMPTS" FROM DUAL
18+
UNION ALL
19+
SELECT 'WHISKY JACK' "FULL_NAME", '2241' "PIN", '2' "FAILED_ATTEMPTS" FROM DUAL)
20+
21+
SELECT * FROM FOO;
22+
```
23+
24+
notepad++ regexp
25+
26+
find what: ```(.*)\s+(\d{4})\s(\d+)```
27+
replace with: ```SELECT '\1' "FULL_NAME", '\2' "PIN", '\3' "FAILED_ATTEMPTS" FROM DUAL UNION ALL```
28+
29+
make sure you have enabled regular expression in search mode!
30+
31+
then obviously you'll have to format and remove unnecessary UNIONs

0 commit comments

Comments
 (0)