这个正则表达式如何将文本分成句子?

Noa*_*oam 1 php regex perl

我知道这个正则表达式将文本分成句子.有人能帮我理解怎么样?

/(?<!\..)([\?\!\.])\s(?!.\.)/
Run Code Online (Sandbox Code Playgroud)

too*_*lic 14

您可以使用YAPE :: Regex :: Explain来解密Perl正则表达式:

use strict;
use warnings;
use YAPE::Regex::Explain;

my $re = qr/(?<!\..)([\?\!\.])\s(?!.\.)/;
print YAPE::Regex::Explain->new($re)->explain();

__END__

The regular expression:

(?-imsx:(?<!\..)([\?\!\.])\s(?!.\.))

matches as follows:

NODE                     EXPLANATION
----------------------------------------------------------------------
(?-imsx:                 group, but do not capture (case-sensitive)
                         (with ^ and $ matching normally) (with . not
                         matching \n) (matching whitespace and #
                         normally):
----------------------------------------------------------------------
  (?<!                     look behind to see if there is not:
----------------------------------------------------------------------
    \.                       '.'
----------------------------------------------------------------------
    .                        any character except \n
----------------------------------------------------------------------
  )                        end of look-behind
----------------------------------------------------------------------
  (                        group and capture to \1:
----------------------------------------------------------------------
    [\?\!\.]                 any character of: '\?', '\!', '\.'
----------------------------------------------------------------------
  )                        end of \1
----------------------------------------------------------------------
  \s                       whitespace (\n, \r, \t, \f, and " ")
----------------------------------------------------------------------
  (?!                      look ahead to see if there is not:
----------------------------------------------------------------------
    .                        any character except \n
----------------------------------------------------------------------
    \.                       '.'
----------------------------------------------------------------------
  )                        end of look-ahead
----------------------------------------------------------------------
)                        end of grouping
----------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)


tan*_*ius 5

还有就是正则表达式分析,这将做的相当一样toolic已经建议-而是完全基于Web的.