Hello All,
 
 I am trying to convert the following perl code into xquery. but am not getting 
the expected result. Can you please help me out?
Overview:- I am trying to append an underscore between multitoken titles.
Perl code:-
 
$str='John Smith, ref. nat. dr. med. vet. three ref. nat.';
print "$str\n";
$str =~ s/\s+/  /g;
print "$str\n";
sub a { my $title = shift; print "title=$title\n"; $title =~ s/  /_/g; 
return($title); }
$str =~ s/(^| )(dr\.|ref\.  nat\.|med.  vet.  three)( |$)/$1 . a($2) . $3/eg;
$str =~ s/\s+/ /g;
print "$str\n";
 
output --- 'John Smith, ref._nat. dr. med._vet._three ref._nat.
 
Thanks and Regards,
Sai.
 
 
 
 


      
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to