3 Generic regexps to build lenses
5 Author: Raphael Pinson <raphink@gmail.com>
8 This file is licensed under the LGPLv2+, like the rest of Augeas.
16 let opt_space = /[ \t]*/
17 let space_in = /[^ \t\n].*[^ \t\n]|[^ \t\n]/
18 let no_spaces = /[^ \t\n]+/
21 let word = /[A-Za-z0-9_.-]+/
22 let integer = /[0-9]+/
23 let decimal = /[0-9]+([.,][0-9]+)?/
25 (* A filesystem path *)
26 let fspath = /[^ \t\n]+/
29 (* Anything but a space, a comma or a comment sign *)
30 let neg1 = /[^,# \n\t]+/
35 * Cf. http://blog.mes-stats.fr/2008/10/09/regex-ipv4-et-ipv6/ (in fr)
39 let digits = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/ in
40 digits . dot . digits . dot . digits . dot . digits
43 /(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})/
44 | /(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})/
45 | /(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})/
46 | /(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})/
47 | /(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})/
48 | /(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})/
49 | ( /([0-9A-Fa-f]{1,4}:){6}/
50 . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/
51 . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/
53 | ( /([0-9A-Fa-f]{1,4}:){0,5}:/
54 . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/
55 . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/
57 | ( /::([0-9A-Fa-f]{1,4}:){0,5}/
58 . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/
59 . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/
61 | ( /[0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}/
64 | /(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})/
65 | /(([0-9A-Fa-f]{1,4}:){1,7}:)/
70 * A Linux device name like eth0 or i2c-0. Might still be too restrictive
73 let device_name = /[a-zA-Z0-9_?.+:!-]+/
76 * Variable: email_addr
79 let email_addr = /[A-Za-z0-9_\+\.-]+@[A-Za-z0-9_\.-]+/