Non-greedy matching for votestrings.
A single choice on a ballot has this format: #1 [ ] This or that The regexp in uvvote.pl's process_vote() will match and extract what's beetwen "[" and "]". But if "This or that" contains a "]", the match will be too greedy: #1 [ ] This [or that] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- match Fix that by using a non-greedy operator. Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
		
							parent
							
								
									f90cfdb57f
								
							
						
					
					
						commit
						a7ea02d592
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -271,7 +271,7 @@ sub process_vote {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    # this matches on a single appearance:
 | 
			
		||||
    if ($$body =~ /#$votenum\W*?\[(.+)\]/) {
 | 
			
		||||
    if ($$body =~ /#$votenum\W*?\[(.+?)\]/) {
 | 
			
		||||
      # one or more vote strings were found
 | 
			
		||||
      $onevote ||= 1; # set $onevote to 1 if it was 0
 | 
			
		||||
      my $votestring = $1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue