Regular Expression bug?

jose isaias cabrera jicman at gmail.com
Thu Mar 2 22:27:13 EST 2023


On Thu, Mar 2, 2023 at 8:30 PM Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 02Mar2023 20:06, jose isaias cabrera <jicman at gmail.com> wrote:
> >This re is a bit different than the one I am used. So, I am trying to
> >match
> >everything after 'pn=':
> >
> >import re
> >s = "pm=jose pn=2017"
> >m0 = r"pn=(.+)"
> >r0 = re.compile(m0)
> >s0 = r0.match(s)
>
> `match()` matches at the start of the string. You want r0.search(s).
> - Cameron Simpson <cs at cskk.id.au>

Thanks. Darn it! I knew it was something simple.


-- 

What if eternity is real?  Where will you spend it?  Hmmmm...


More information about the Python-list mailing list