python-stringcase icon indicating copy to clipboard operation
python-stringcase copied to clipboard

alphanumcase : Deprecated regex on Pypi version 1.2.0

Open Dodobibi opened this issue 4 years ago • 2 comments

The package on pypi is not the same of this repo.

On this repo : https://github.com/okunishinishi/python-stringcase/blob/50fe41d3c9bebf001f24fc49b89fe023b5eba12c/stringcase.py#L245

On pypi :

def alphanumcase(string):
    """Cuts all non-alphanumeric symbols,
    i.e. cuts all expect except 0-9, a-z and A-Z.

    Args:
        string: String to convert.

    Returns:
        string: String with cutted non-alphanumeric symbols.

    """
    # return filter(str.isalnum, str(string))
    return re.sub("\W+", "", string)

DeprecationWarning: invalid escape sequence \W : return re.sub("\W+", "", string)

Must be :

return re.sub(r"\W+", "", string)

Dodobibi avatar Feb 28 '20 08:02 Dodobibi

We need a new release to ship this fix. :-) @okunishinishi is it feasible to do it? 🙏🏼

pietrodn avatar Oct 12 '21 16:10 pietrodn

@okunishinishi Hey, could you please ship this?)

tworedz avatar Mar 27 '24 12:03 tworedz