Regular expressions question
Duncan Booth
duncan.booth at invalid.invalid
Tue Jan 16 06:59:35 EST 2007
"Victor Polukcht" <vpolukcht at gmail.com> wrote:
> I have 2 strings:
>
> "Global etsi3 *200 ok 30 100% 100%
> Outgoing"
> and
> "Global etsi3 * 4 ok 30 100% 100%
> Outgoing"
>
> The difference is "*200" instead of "* 4". Is there ability to write a
> regular expression that will match both of that strings?
>
Yes, ".*" would match both of the strings, but not in a useful way. You'll
have to consider which strings you *don't* want to match as well as which
ones you do and whether you want to extract any information from the
strings or find the ones which match.
But first take a step back and look at the problem as a whole. You didn't
say what you are trying to do, and often people will jump at regular
expressions as the solution when there may be better ways of doing what
they want without writing a regular expression.
What do you really want to do?
More information about the Python-list
mailing list