home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.privacy      Discussing privacy, laws, tinfoil hats      112,125 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 110,539 of 112,125   
   D to All   
   Regular expressions (regex) (3/3)   
   10 Aug 24 21:09:14   
   
   [continued from previous message]   
      
   >modifier /g is Off then '+' works as '+?', '*' as '*?' and so on   
   >x   
   >Extend your pattern's legibility by permitting whitespace and comments   
   >(see explanation below).   
   >The modifier /x itself needs a little more explanation. It tells the   
   >regular expression engine to ignore whitespace that is neither backslashed   
   >nor within a character class. You can use this to break up your regular   
   >expression into (slightly) more readable parts. The # character is also   
   >treated as a metacharacter introducing a comment, for example:   
   >   (   
   >   (abc) # comment 1   
   >    | # You can use spaces to format r.e. - the r.e. engine ignores it   
   >   (efg) # comment 2   
   >   )   
   >This also means that if you want real whitespace or # characters in the   
   >pattern (outside a character class, where they are unaffected by /x), that   
   >you'll either have to escape them or encode them using octal or hex   
   >escapes. Taken together, these features go a long way towards making   
   >regular expressions text more readable.   
   >Perl extensions   
   >(?imsxr-imsxr)   
   >You may use it into r.e. for modifying modifiers by the fly. If this   
   >construction inlined into subexpression, then it effects only into this   
   >subexpression   
   >Examples:   
   >  (?i)Saint-Petersburg       matches 'Saint-petersburg' and   
   >                             'Saint-Petersburg'   
   >  (?i)Saint-(?-i)Petersburg  matches 'Saint-Petersburg' but not   
   >                             'Saint-petersburg'   
   >  (?i)(Saint-)?Petersburg    matches 'Saint-petersburg' and   
   >                             'saint-petersburg'   
   >  ((?i)Saint-)?Petersburg    matches 'saint-Petersburg', but not   
   >                             'saint-petersburg'   
   >(?#text)   
   >A comment, the text is ignored. Note that the regular expression engine   
   >closes the comment as soon as it sees a ")", so there is no way to put a   
   >literal ")" in the comment.   
   [end quoted plain text]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca