After I've run the re.search function on a string and no match was
found, how can I access that string? When I try to print it directly,
it's an empty string, I assume because it has been consumed. How do
I prevent this?
It seems to work fine for this 2.x code:
import urllib.request
import re
On Thu, Jun 23, 2011 at 1:58 PM, John Salerno johnj...@gmail.com wrote:
After I've run the re.search function on a string and no match was
found, how can I access that string? When I try to print it directly,
it's an empty string, I assume because it has been consumed. How do
I prevent this?
On Jun 23, 3:47 pm, Ian Kelly ian.g.ke...@gmail.com wrote:
On Thu, Jun 23, 2011 at 1:58 PM, John Salerno johnj...@gmail.com wrote:
After I've run the re.search function on a string and no match was
found, how can I access that string? When I try to print it directly,
it's an empty string, I
There is also
print(match_obj.string)
which gives you a copy of the string searched. See end of section
6.2.5. Match Objects
At 02:58 PM 6/23/2011, John Salerno wrote:
After I've run the re.search function on a string and no match was
found, how can I access that string? When I try to
On Jun 23, 4:47 pm, Thomas L. Shinnick tshin...@prismnet.com
wrote:
There is also
print(match_obj.string)
which gives you a copy of the string searched. See end of section
6.2.5. Match Objects
I tried that, but the only time I wanted the string printed was when
there *wasn't* a match,