In article ,
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 quotes
>
> test=''
[...]
> but if a take tho
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
test='''_*_n.jpg","timelineCoverPhoto":"{\"focus\":{\"x\":0.5,\"y\":0.386925795053},\"p
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
test='''_*_n.jpg","timelineCoverPhoto":"{\"focus\":{\"x\":0.5,\"y\":0.386925795053},\"p
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 wan
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 w
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+
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
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"(t
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 ma
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.
>>>
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
--
http://mail.python.org/ma
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
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.
--
http://mail.python.org/mailm
> 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"
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.
--
http
> 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 likel
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:
re.compile
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
> pa
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
19 matches
Mail list logo