[Tutor] Finding wich word matched in a OR re

Bernard Lebel 3dbernard at gmail.com
Thu Nov 10 19:46:06 CET 2005


Never mind, just came accross "groups" of the match object. Can't
believe there is such a nice feature!


Cheers
Bernard




On 11/10/05, Bernard Lebel <3dbernard at gmail.com> wrote:
> Hello,
>
> I have compiled this regular expression, with 3 strings. Basically it
> looks like this.
>
> r'word1|word2|word3'
>
> The point is to try to match one of these words in a string.
>
>
> Now let say I indeed got a match in a string. How can I find out wich
> one, between word1-word2-word3 has the string been matched to?
>
>
> Thanks
> Bernard
>


More information about the Tutor mailing list