Basic HTML version of Foils prepared Sept 20 97

Foil 44 (?..) Constructs in Regular Expressions - I

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


1 (?#comment) is a comment in a regular expression
  • m/[aA][bB](?#matches aB Ab ab AB)/; # is example
2 /x modifier interprets whitespace in regular expression as for readability and not as "real" characters -- the Perl manual gives an example shown below which removes /* .. */ from C programs
3 $program =~ s{
  • /\* # match opening delimiter /*
  • .*? # minimal match to anything
  • \*/ # closing delimiter */
4 }[]gsx; # Replace with nothing (i.e. remove) and specify modifiers g s and x to be operational

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Apr 5 1998