1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Tests for regexp module:
#regexp /\s//
Get rid of all whitespace on a line
including newline
#regexp /$/__NEWLINE__/
Get rid of all whitespace on a line but keep newline
#regexp /g/G/
Change all lowercase g's to uppercase and remove whitespace
#rmregexp /\s//
#rmregexp /$/__NEWLINE__/
#rmregexp /g/G/
#regexp /\s{2,}/ /
Change all multiple whitespace to single whitespace
#rmregexp /\s{2,}/ /
#regexp /^\s+//
Remove all whitespace from start of line
#regexp /\s+$/__NEWLINE__/
Remove all whitespace from end of line
#define MACRO test
MACRO
#regexp /inside/MACRO/
Test of macros inside regexps
#define MACARGS(ARG) "Macro with ARG"
#regexp /MACARGS(foo)/bar/
"Macro with foo" MACARGS(foo)
Reminder - regexps also work with normal #if keyword (regexp module not needed)
#if ("MACRO" =~ /\d/)
WRONG
#endif
#define MACRO 123
#if ("MACRO" =~ /\d/)
RIGHT
#endif
#regexp /\/\/\s+(keyword|test|result)/In comment: <$1>/
// keyword and other stuff
// no change
// test
// result
#regexp /\s\/a/b/
#regexp /\s\/a/b/
this is a testa
this is a test /a
#rmregexp /\s\/a/b/
this is a testa
this is a test /a
#rmregexp /\s\/a/b/
this is a testa
this is a test /a
|