File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,33 @@ body_filter_by_lua_file conf/lua/minify/minify.lua;
62
62
#more config settings and some server stuff
63
63
}
64
64
```
65
+
66
+
67
+ # Building your own regex rules to apply inside this script :
68
+
69
+ Using my code examples below copy and paste them to test and edit and build your own regex on the Lua demo site here :
70
+
71
+ https://www.lua.org/cgi-bin/demo
72
+
73
+ #### Examples :
74
+
75
+ ##### Basic :
76
+ ```
77
+ local string = "<style>lol1/* ok lol */lol2</style>"
78
+ local regex = "<style>(.*)%/%*(.*)%*%/(.*)</style>"
79
+ local replace_with = "<style>%1%3</style>"
80
+ local output = string.gsub(string, regex, replace_with)
81
+ print(output)
82
+ ```
83
+
84
+ ##### Advanced :
85
+ ```
86
+ local add_to_string = [[added me!]]
87
+ local string = [[<style>lol1/* ok lol */lol2</style>]] .. add_to_string .. [[
88
+ hello world!
89
+ ]]
90
+ local regex = "<style>(.*)%/%*(.*)%*%/(.*)</style>"
91
+ local replace_with = "<style>%1%3</style>"
92
+ local output = string.gsub(string, regex, replace_with)
93
+ print(output)
94
+ ```
You can’t perform that action at this time.
0 commit comments