in reply to Regexp matching on a multiline file: dealing with line breaks
In this case, I will assume you are loading the entire file into memory; if you are not, you will need to work with "strange buffers and things like that". It looks like your format has no whitespace dependence, so one easy way to do it is to allow arbitrary whitespace in your regex:
which could be written more maintainably as:/k\s*i\s*t\s*t\s*e\s*n/;
my $string = 'kitten'; my $regex = join '\s*', split //, $string; /$regex/;
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|