Browse Source

Improve regexes for separating kws, IDs and expressions

Alois Mahdal 10 years ago
parent
commit
3800da921c
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      ffoo/saturnin_www.sh

+ 3
- 4
ffoo/saturnin_www.sh View File

10
     #
10
     #
11
     sed -e 's/(\d)\</\n/;'\
11
     sed -e 's/(\d)\</\n/;'\
12
       | perl -ne '
12
       | perl -ne '
13
-            next unless m/\b([a-zA-Z]{2,}\s*=\s*\d+)\b/;
13
+            next unless m/\b([a-zA-Z]\w*\s*=\s*\w+)\b/;
14
             print "$1\n";
14
             print "$1\n";
15
         ' \
15
         ' \
16
       | debug_pipe ex_lookalikes
16
       | debug_pipe ex_lookalikes
23
     #
23
     #
24
     tr ' ' '\n' \
24
     tr ' ' '\n' \
25
       | perl -ne '
25
       | perl -ne '
26
-            next unless m/\b([a-zA-Z]{2,}#\d+)\b/;
26
+            next unless m/\b([a-zA-Z]\w*#\w+)\b/;
27
             print "$1\n";
27
             print "$1\n";
28
         ' \
28
         ' \
29
       | debug_pipe id_lookalikes
29
       | debug_pipe id_lookalikes
34
     #
34
     #
35
     # Hack out lines that look like kw expressions
35
     # Hack out lines that look like kw expressions
36
     #
36
     #
37
-    local kwbase="[a-z][a-z0-9]*"
38
-    grep -e "^$kwbase " -e "^$kwbase\$" \
37
+    grep -Ee '^[a-zA-Z]\w*\s+[^=]' -e '^[a-zA-Z]\w*$' \
39
         | debug_pipe kw_lookalikes
38
         | debug_pipe kw_lookalikes
40
 }
39
 }
41
 
40