[MarkLogic Dev General] xquery equivalent for perl code

sai shanker lsaishanker at yahoo.com
Thu Jun 3 12:30:48 PDT 2010


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.
 
 
 
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20100603/8f923d6d/attachment.html 


More information about the General mailing list