[Tutor] Regular expression error
3dbernard at gmail.com
Thu Jul 28 21:37:54 CEST 2005
On 7/28/05, Kent Johnson <kent37 at tds.net> wrote:
> This will match a string of digits followed by any non-digit, is that what you want? If you want to restrict it to digits followed by a letter you should use
> Also this will match something like 123A456B, if you want to disallow anything after the letter you need to match the end of the string:
Nice, thanks a bunch.
> The problem is you are calling the module (re) match, not the instance (oPattern) match. re.match() expects the second argument to be a string. Just use
> oMatch = oPattern.match( str( oArg ), 0 )
> The hint in the error is "expected string or buffer". So you are not giving the expected argument types which should send you to the docs to check...
You're right. Thanks for the heads up.
More information about the Tutor