mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +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);
|
||||
|
||||
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;
|
||||
|
||||
if($section =~ s/p(\d+)//i) {
|
||||
@ -113,11 +113,8 @@ while($text =~ m/^\s{4}(\d+\.[0-9\.]*)/msg) {
|
||||
}
|
||||
|
||||
if(length $search) {
|
||||
|
||||
# print "$p\n";
|
||||
# print "[$t]\n";
|
||||
|
||||
if($t =~ m/$search/ms) {
|
||||
eval {
|
||||
if($t =~ m/\b$search\b/ms) {
|
||||
$matches++;
|
||||
if($matches >= $match) {
|
||||
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;
|
||||
|
||||
if($paragraph_specified) {
|
||||
|
Loading…
Reference in New Issue
Block a user