1) Please don't top-post...it makes it hard to reply in context
2) You may want to "reply to all" so that the mailing list gets
CC'd...there are lots of smart folks on the list, and by replying
only to me, you limit your options to the meager extents of my
knowledge.
>>> I would like to search
T:
> I meant to say: Search for any character in r'/\:*?"<>|' in a string
You don't need a RE to solve such problem. There are many ways to solve
it, this is one of the simpler (Python 2.4+):
>>> chars = set(r'/\:*?"<>|')
>>> s1 = "is this a sample string?"
>>> bool( set(s1) & chars )
True
>>> s
> I would like to search for any of the strings in r'/\:*?"<>|' in a
> string using RE module. Can someone tell me how?
use the search() method of the regexp object.
r = re.compile(r'[/\:*?"<>|]')
results = r.search(a_string)
or, if you're interested in the first location:
r.finditer(target).n
On 2006-09-22, T <[EMAIL PROTECTED]> wrote:
> I meant to say: Search for any character in r'/\:*?"<>|' in a
> string Sorry
Ford Prefect puts The Python Documentation down on his satchel
and lies down to sleep. He whispers, "I don't want to spoil
anything, but you'll never get anywhere using
I meant to say: Search for any character in r'/\:*?"<>|' in a string
Sorry
T wrote:
> I would like to search for any of the strings in r'/\:*?"<>|' in a
> string using RE module. Can someone tell me how?
>
> Thanks!
--
http://mail.python.org/mailman/listinfo/python-list