Skip to content

List out of range error #1

Description

@mystardious

Hey Andy,

Problem:

I found a small bug when testing the code you provided:

image

I've located the problem to be with the lambda function you use to extract special characters, more specifically with:

extract_special_chars = lambda string: ([char for char in re.findall(r"[^\w]", string)], ...

Example input:

fpe_encrypt_or_decrypt('WD_DistServiceCapital', 'ENCRYPT')

Solution

Code throws an error when using underscores because it is part of \w character set.

I suggest changing it the following:

re.findall(r"[^a-zA-Z0-9]", string)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions