我正在解析一些html页面,需要检测里面的任何阿拉伯字符.试过各种正则表达式,但没有运气..
有谁知道这样做的工作方式?
谢谢
这是我正在处理的页面:http: //pastie.org/2509936
我的代码是:
#!/usr/bin/perl
use LWP::UserAgent;
@MyAgent::ISA = qw(LWP::UserAgent);
# set inheritance
$ua = LWP::UserAgent->new;
$q = 'pastie.org/2509936';;
$request = HTTP::Request->new('GET', $q);
$response = $ua->request($request);
if ($response->is_success) {
if ($response->content=~/[\p{Script=Arabic}]/g) {
print "found arabic";
} else {
print "not found";
}
}
Run Code Online (Sandbox Code Playgroud)