Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80498 > unrolled thread

What does (?P<name>) pattern syntax do?

Started bysatishmlmlml@gmail.com
First post2014-11-10 15:13 -0800
Last post2014-11-11 10:19 +1100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  What does (?P<name>) pattern syntax do? satishmlmlml@gmail.com - 2014-11-10 15:13 -0800
    Re: What does (?P<name>) pattern syntax do? Ben Finney <ben+python@benfinney.id.au> - 2014-11-11 10:19 +1100

#80498 — What does (?P<name>) pattern syntax do?

Fromsatishmlmlml@gmail.com
Date2014-11-10 15:13 -0800
SubjectWhat does (?P<name>) pattern syntax do?
Message-ID<dca748b5-8c26-4908-bf49-3cd694b37bfb@googlegroups.com>
What does ?P and <part1> match in the following piece of code?

re.search('(?P<part1>\w*)/(?P<part2>\w*)', '...aaa/bbb/ccc]').groups()

[toc] | [next] | [standalone]


#80499

FromBen Finney <ben+python@benfinney.id.au>
Date2014-11-11 10:19 +1100
Message-ID<mailman.15644.1415661610.18130.python-list@python.org>
In reply to#80498
satishmlmlml@gmail.com writes:

> What does ?P and <part1> match in the following piece of code?

Learn about Python's regular expression features from the documentation
<URL:https://docs.python.org/3/library/re.html>.

Experiment with regular expressions using online tools such as
<URL:https://pythex.org/>.

-- 
 \       “From the moment I picked your book up until I laid it down I |
  `\        was convulsed with laughter. Someday I intend reading it.” |
_o__)                                                    —Groucho Marx |
Ben Finney

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web