R
Roger Johansson
I have been trying to learn more about regular expressions. I have
tried many programs and read a lot of help files.
I finally managed to use regexp in BK-Replace-em to change all the
<body background...> tags in a number of html files into a plain
<body>, for example. My first success with regexpressions!
Search expression, replace expression:
<[Bb][Oo][Dd][Yy][^>]*> <body>
I learned how to use the Tcl/Tk script visual_regexp.tcl to test
regular expressions.
Now I want to learn how to use perl to perform the same type of tasks,
replacing one expression with another in multiple files, for example
in all files in a certain directory.
I have installed ActivePerl 5.8 and have read pod files for many
hours. But I still cannot write a program for this kind of task in
perl. I am a total beginner in using perl.
Could somebody please show me how to write a perl script to change a
number of files with a regexp search and replace, like I did in
BK-Replacem?
I have read perlrequick and perlretut and I understand how to use
regular expressions, but how do I handle the directory and files, and
maybe I have to create loops to read in each file into a string,
etc..?
A practical example script would help a lot.
tried many programs and read a lot of help files.
I finally managed to use regexp in BK-Replace-em to change all the
<body background...> tags in a number of html files into a plain
<body>, for example. My first success with regexpressions!
Search expression, replace expression:
<[Bb][Oo][Dd][Yy][^>]*> <body>
I learned how to use the Tcl/Tk script visual_regexp.tcl to test
regular expressions.
Now I want to learn how to use perl to perform the same type of tasks,
replacing one expression with another in multiple files, for example
in all files in a certain directory.
I have installed ActivePerl 5.8 and have read pod files for many
hours. But I still cannot write a program for this kind of task in
perl. I am a total beginner in using perl.
Could somebody please show me how to write a perl script to change a
number of files with a regexp search and replace, like I did in
BK-Replacem?
I have read perlrequick and perlretut and I understand how to use
regular expressions, but how do I handle the directory and files, and
maybe I have to create loops to read in each file into a string,
etc..?
A practical example script would help a lot.