Basic HTML version of Foils prepared Sept 20 97

Foil 48 More Substitution Examples

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


In code, replace an array subscript [...] with [n++]
Search: \[[^]]+\]
Replace: [n++]
PERL: s/\[[^]]+\]/[n++]/g
In an HTML doc, replace certain file references in URLs
Search: ys97_(\d\d)/
Replace: ys97_\1/index.html
PERL: s#ys97_(\d\d)/#ys97_\1/index.html#
Again in an HTML doc, replace certain paths in URLs
Search: ([^/])\.\./graphics
Replace: \1../../latex-graphics
PERL: s%([^/])\.\./graphics%\1../../latex-graphics%



© 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 Sep 21 1997