in reply to Re: use regex to split sentence
in thread use regex to split sentence

That's not what I want.
aa bb hee ... loveU
in fact I realy want to know what pattern can match the result I expected--I mean below:
X1aa X2bb X3hee X4... X5loveU

Replies are listed 'Best First'.
Re: Re: Re: use regex to split sentence
by djantzen (Priest) on Nov 01, 2002 at 07:56 UTC

    Try this:

    @match = /X\d[^X]+/g;

    Basically it slurps up everything that's not an 'X' after doing matching 'X\d'.

      thanks. in fact, it could be "X1XloveU".and I want it to be matched. this is just a simplified example about my work.
      in fact, 'X\d'could follow any string apart from 'X\d'. i.e.it could be "X1XXXIloveU". This is just a simplified example about my work. Any idea not let * eat all words followed?