View Single Post
Old 04-09-2018, 02:53 AM   #3
DrChiper
Bookish
DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.
 
DrChiper's Avatar
 
Posts: 1,029
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
Hi Kovid, you are absolutely right: (?<=M)\*M works.
But, that is not the expression I used

My expression also used a positive lookahead part

(?<=M)\s*(?=M)

which fails when \s* is empty. Further, when succeeding M<space>M text constructs are present after the very first MM construct, they are also not found, because the search is stopped immediately and the attached error message is displayed.

I use a text like: adasMMasd adssdM Masdda M Msad

Although my regex knowledge is limited, I cannot recall that there should be a limitation on the expected behavior when (assumed) greedy search would certainly be able to find the other M's ones.

Is there an explanation you know of?

Addation: I use the lookahead construct specifically in order to not "consume" the found text.
Attached Thumbnails
Click image for larger version

Name:	calibre3.jpg
Views:	442
Size:	21.7 KB
ID:	163335  

Last edited by DrChiper; 04-09-2018 at 02:59 AM.
DrChiper is offline   Reply With Quote