s modifier doesn't seem to work

C

Charles DeRykus

On 8/13/2013 12:05 AM, (e-mail address removed) wrote:
...
I think Ben's suggestion is the most promising if you want to identify
the sentences over which the match extends:

while (my ($match) =
$alles =~ /([^\n]* \d .* Zahl [^\n]*)/gsx
# or perhaps /(.* \d (?s:.)* Zahl .*)/gx
# or /(\N* \d .* Zahl \N*)/gsx if you've got 5.12
) {
for my $satz (split /\n/, $match) {
# make that /(?<=\n)/ if you don't want to chomp
print "sentence is part of match: $satz\n\n";
}
}

Also, to take care of the endless loop problem:

while (my ($match) =$alles =~ /([^\n]* \d .* Zahl [^\n]*)/gsx ) {

Replace above with:

for my $match ($alles =~ /([^\n]* \d .* Zahl [^\n]*)/gsx/) {
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,098
Messages
2,570,625
Members
47,236
Latest member
EverestNero

Latest Threads

Top