[Scilab-users] multiples captures with regexp

Samuel Gougeon sgougeon at free.fr
Wed Sep 4 22:39:38 CEST 2013


Hello,

I would like to slice the following string with regexp:

texte = "voir http://help.scilab.org/docs/5.4.1/fr_FR/regexp.html";
[iD, iF, matchs, captures] = 
regexp(texte,"|[^\s]+\:\/\/([^\/]+\/)+([^\/]*$)|i"); captures

returning

!fr_FR/ regexp.html !

while i would expect

help.scilab.org/ docs/ 5.4.1/ fr_FR/ regexp.html

since the capturing parentheses are iterated /at leas/t once by the 
ending + (as {1,} would do)  in
([^\/]+\/)+

This slicing it likely possible with strtok() or strindex(), but i do 
not understand why with regexp
the iteration is not performed. Nor with
([^\/]+?\/)+

Any hint would be appreciated
Regards
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130904/172d5b3e/attachment.htm>


More information about the users mailing list