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


Groups > comp.lang.python > #17994

Re: Regular expressions

References <495b6fe6-704a-42fc-b10b-484218ad8409@b20g2000pro.googlegroups.com>
Date 2011-12-27 11:00 +1100
Subject Re: Regular expressions
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4117.1324944010.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Dec 27, 2011 at 10:45 AM, mauriceling@acm.org
<mauriceling@gmail.com> wrote:
> Hi
>
> I am trying to change <one string> to <another string>.
>
> Can anyone help me with the regular expressions needed?

A regular expression defines a string based on rules. Without seeing a
lot more strings, we can't know what possibilities there are for each
part of the string. You probably know your data better than we ever
will, even eyeballing the entire set of strings; just write down, in
order, what the pieces ought to be - for instance, the first token
might be a literal @ sign, followed by three upper-case letters, then
a hyphen, then any number of alphanumerics followed by a colon, etc.
Once you have that, it's fairly straightforward to translate that into
regex syntax.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Regular expressions "mauriceling@acm.org" <mauriceling@gmail.com> - 2011-12-26 15:45 -0800
  Re: Regular expressions Chris Angelico <rosuav@gmail.com> - 2011-12-27 11:00 +1100
    Re: Regular expressions "mauriceling@acm.org" <mauriceling@gmail.com> - 2011-12-26 16:15 -0800
      Re: Regular expressions Fredrik Tolf <fredrik@dolda2000.com> - 2011-12-27 06:01 +0100
        Re: Regular expressions rusi <rustompmody@gmail.com> - 2011-12-27 23:05 -0800
  Re: Regular expressions Roy Smith <roy@panix.com> - 2011-12-26 19:07 -0500
  Re: Regular expressions Jason Friedman <jason@powerpull.net> - 2011-12-27 00:16 +0000
    Re: Regular expressions "mauriceling@acm.org" <mauriceling@gmail.com> - 2011-12-26 16:24 -0800
      Re: Regular expressions Jason Friedman <jason@powerpull.net> - 2011-12-27 01:26 +0000

csiph-web