Class: Regexp
Overview
Copyright © 2016 Freescale Semiconductor Inc.
Class Method Summary collapse
-
.constant ⇒ Regexp
Ruby constant e.g.
-
.identifier ⇒ Regexp
C identifier e.g.
-
.nmtoken ⇒ Regexp
XML NMTOKEN e.g xml:attribute, also-valid, CDATA.
Class Method Details
.constant ⇒ Regexp
Returns Ruby constant e.g. Constant, CONSTANT.
16 17 18 |
# File 'lib/duxml/ruby_ext/regexp.rb', line 16 def constant /\b([A-Z][a-zA-Z0-9_]*)\b/ end |
.identifier ⇒ Regexp
Returns C identifier e.g. ident_ifier0, excluding ‘true’ and ‘false’.
6 7 8 |
# File 'lib/duxml/ruby_ext/regexp.rb', line 6 def identifier /(?:(?!true|false))\b([a-zA-Z_][a-zA-Z0-9_]*)\b/ end |
.nmtoken ⇒ Regexp
Returns XML NMTOKEN e.g xml:attribute, also-valid, CDATA.
11 12 13 |
# File 'lib/duxml/ruby_ext/regexp.rb', line 11 def nmtoken /(?!\s)([a-zA-Z0-9_\-.:]*)(?!\s)/ end |