mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 03:02:47 +01:00
-section now optional; instead, will check if search term starts with digits followed by a period, and if so, extract that as section
This commit is contained in:
parent
f9cd8ae88d
commit
a56a297460
@ -14,7 +14,7 @@ if(not length $search) {
|
|||||||
|
|
||||||
my ($section, $paragraph, $section_specified, $paragraph_specified, $match, $list_only);
|
my ($section, $paragraph, $section_specified, $paragraph_specified, $match, $list_only);
|
||||||
|
|
||||||
if($search =~ s/-section ([0-9\.p]+)//i) {
|
if($search =~ s/-section\s*([0-9\.p]+)//i or $search =~ s/\b(\d+\.[0-9\.p]*)//i) {
|
||||||
$section = $1;
|
$section = $1;
|
||||||
|
|
||||||
if($section =~ s/p(\d+)//i) {
|
if($section =~ s/p(\d+)//i) {
|
||||||
@ -113,11 +113,8 @@ while($text =~ m/^\s{4}(\d+\.[0-9\.]*)/msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(length $search) {
|
if(length $search) {
|
||||||
|
eval {
|
||||||
# print "$p\n";
|
if($t =~ m/\b$search\b/ms) {
|
||||||
# print "[$t]\n";
|
|
||||||
|
|
||||||
if($t =~ m/$search/ms) {
|
|
||||||
$matches++;
|
$matches++;
|
||||||
if($matches >= $match) {
|
if($matches >= $match) {
|
||||||
if($list_only) {
|
if($list_only) {
|
||||||
@ -132,9 +129,14 @@ while($text =~ m/^\s{4}(\d+\.[0-9\.]*)/msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
if($@) {
|
||||||
|
print "Error in search regex; you may need to escape characters such as *, ?, ., etc.\n";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
last if $found == 1;
|
last if $found == 1;
|
||||||
|
|
||||||
if($paragraph_specified) {
|
if($paragraph_specified) {
|
||||||
|
Loading…
Reference in New Issue
Block a user