i want to find a specific urls from a txt file but i have some issus. First
when i take just two lines from the file with copy paste and assign it to a
variable like this and it works only with triple quotes
i want to find a specific urls from a txt file but i have some issus. First
when i take just two lines from the file with copy paste and assign it to a
variable like this and it works only with triple quotes
In article caeba811-441e-42a0-9b2b-c743205b1...@googlegroups.com,
dimm...@gmail.com wrote:
i want to find a specific urls from a txt file but i have some issus. First
when i take just two lines from the file with copy paste and assign it to a
variable like this and it works only with triple
On Nov 7, 3:13 pm, Chris Rebert [EMAIL PROTECTED] wrote:
On Thu, Nov 6, 2008 at 11:06 PM, [EMAIL PROTECTED] wrote:
I always have no idea about how to express conclude the entire word
with regexp, while using python, I encountered this problem again...
for example, if I want to match the
I always have no idea about how to express conclude the entire word
with regexp, while using python, I encountered this problem again...
for example, if I want to match the string in test a string,
re.findall(r[^a]* (\w+),test a string) will work, but what if
there is not a but an(test a
On Nov 7, 3:06 pm, [EMAIL PROTECTED] wrote:
I always have no idea about how to express conclude the entire word
with regexp, while using python, I encountered this problem again...
for example, if I want to match the string in test a string,
re.findall(r[^a]* (\w+),test a string) will work,
On Thu, Nov 6, 2008 at 11:06 PM, [EMAIL PROTECTED] wrote:
I always have no idea about how to express conclude the entire word
with regexp, while using python, I encountered this problem again...
for example, if I want to match the string in test a string,
re.findall(r[^a]* (\w+),test a
Really thanks for quickly reply Chris!
Actually I tried BeautifulSoup and it's great.
But I'm not very familiar with it and it need more codes to parse the html
and get the right text.
I think regexp is more convenient if there is a way to filter out the list
just in one line:)
I did this all the
I have a regex: '[A-Za-z]:\\([^/:\*\?\|])*'
when I do, re.compile('[A-Za-z]:\\([^/:\*\?\|])*') ...I get
sre_constants.error: unbalanced parenthesis
do i need to escape something else? i see that i have matching
parenthesis.
thx
--
http://mail.python.org/mailman/listinfo/python-list
On 28 Jul 2006 05:45:05 -0700, abcd [EMAIL PROTECTED] wrote:
I have a regex: '[A-Za-z]:\\([^/:\*\?\|])*'
when I do, re.compile('[A-Za-z]:\\([^/:\*\?\|])*') ...I get
sre_constants.error: unbalanced parenthesis
do i need to escape something else? i see that i have matching
parenthesis.
abcd wrote:
I have a regex: '[A-Za-z]:\\([^/:\*\?\|])*'
when I do, re.compile('[A-Za-z]:\\([^/:\*\?\|])*') ...I get
sre_constants.error: unbalanced parenthesis
do i need to escape something else? i see that i have matching
parenthesis.
You should use raw string:
when I do, re.compile('[A-Za-z]:\\([^/:\*\?\|])*') ...I get
sre_constants.error: unbalanced parenthesis
Because you're not using raw strings, the escapables become
escaped, making your regexp something like
[A-Za-z]:\([^/:\*\?\|])*
(because it knows what \\ is, but likely doesn't
well thanks for the quick replies, but now my regex doesn't work.
[code]
import re
p = re.compile(r'[A-Za-z]:\\([^/:\*?\|])*')
x = p.match(c:\test)
[/code]
x is None
any ideas why? i escape the back-slash, the asterisk *, and the PIPE |
b/c they are regex special characters.
--
p = re.compile(r'[A-Za-z]:\\([^/:\*?\|])*')
x = p.match(c:\test)
any ideas why? i escape the back-slash, the asterisk *, and the PIPE |
b/c they are regex special characters.
Same problem, only now in the other string:
s = c:\test
print s
c: est
Your \t is interpreted as
sorry i forgot to escape the question mark...
[code]
import re
p = re.compile(r'[A-Za-z]:\\([^/:\*?\|])*')
even when I escape that it still doesnt work as expected.
p = re.compile(r'[A-Za-z]:\\([^/:\*\?\|])*')
p.match('c:\test') still returns None.
--
Sybren Stuvel wrote:
Yes, because after the c: you expect a backslash, and not a tab
character. Read the manual again about raw strings and character
escaping, it'll do you good.
doh. i shall do that.
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
not sure why this passes:
regex = r'[A-Za-z]:\\([^/:\*\?\|])*'
p = re.compile(regex)
p.match('c:\\test')
_sre.SRE_Match object at 0x009D77E0
p.match('c:\\test?:/')
_sre.SRE_Match object at 0x009D7720
the last example shouldnt give a match
--
regex = r'[A-Za-z]:\\([^/:\*\?\|])*'
p = re.compile(regex)
p.match('c:\\test')
_sre.SRE_Match object at 0x009D77E0
p.match('c:\\test?:/')
_sre.SRE_Match object at 0x009D7720
the last example shouldnt give a match
Ah, but it should, because it *does* match.
m = p.match('c:\\test?:/')
abcd wrote:
not sure why this passes:
regex = r'[A-Za-z]:\\([^/:\*\?\|])*'
p = re.compile(regex)
p.match('c:\\test')
_sre.SRE_Match object at 0x009D77E0
p.match('c:\\test?:/')
_sre.SRE_Match object at 0x009D7720
the last example shouldnt give a match
If you want to learn RE I
19 matches
Mail list logo