in reply to How to use a regex to parse html form tags
I just want to replace /<form[.*]?*\/form>/ with the word "block"Well, there's your first huge mistake (apart from the question whether this is a good idea). You're now looking for "<form", followed by any number of occurrences of either "." or "*", and ending in "/form>". Or, it would if you put in your quantifiers in the correct way:
It makes sense that it finds nothing./<form[.*]*?\/form>/
Where does the idea come from to use square brackets, anyway? Uh, yes, "." is indeed a plain character in a character class. That might be an unexpected pitfall.
So, try again with
The /s is to treat newlines as plain characters in /./s. (You put it after the third slash in s/PAT/REPL/s.)/<form.*?\/form>/s
|
|---|