regex with some special characters allowed

I want regex with following conditions: As first character only A-Za-z is allowed. After first character the following is allowed: A-Z a-z 0-9 and the special characters .-_/ I wrote this regex: ^[A-Za-z][A-Za-z0-9.-_\/]+$ But this allows also different special characters like : ? ! which is wrong. I hope somebody can help me Thanks in… Read More regex with some special characters allowed

Removing Registered Trademark SQL

I have a data set example here: ShipName FedEx International Economy® FedEx Ground® FedEx® International Connect Plus FedEx International Priority® FEDEX® INTERNATIONAL CONNECT PLUS FedEx International Priority® FEDEX INTERNATIONAL PRIORITY® Yet, I want to remove all the special characters, so I can group them together appropriately. I realize I could just use UPPER(), however I… Read More Removing Registered Trademark SQL

TypeError: list indices must be integers or slices, not str when I try to iterate lists of strings with special characters inside some of them

colloquial_numbers = [‘veinti[\\s|-|]tres’, ‘veinti[\\s|-|]dos’, ‘veinti[\\s|-|]uno’, ‘veinte’, ‘tres’, ‘dos’, ‘uno’] symbolic_numbers = [’23’, ’22’, ’21’, ’20’, ‘3’, ‘2’, ‘1’] body = ” for n in coloquial_numbers: body += """ input_text = re.sub(r"{}", "{}", input_text)\n""".format(coloquial_numbers[n], symbolic_numbers[n]) #body += """ input_text = re.sub(r’""" + coloquial_numbers[n] + """’, ‘""" + symbolic_numbers[n] + """’, input_text)\n""" print(repr(body)) output: input_text = re.sub(r"veinti[\s|-|]*tres",… Read More TypeError: list indices must be integers or slices, not str when I try to iterate lists of strings with special characters inside some of them

How to use \ in a string without it's escape effect

I’m trying to implement the next line: with open(‘.\numbers.txt’, ‘r’) as f: The \n in the path is being recognized as the new line special character. >Solution : You can use the raw string by prefixing the string with r print(r’.\numbers.txt’) Or escape the backslashes with \\ print(‘.\\numbers.txt’)

How do I create a function in javascript that only allows letters, numbers, dashes -, underscores _ and spaces?

I have to create a function that takes a string, removes all "special" characters (e.g. !, @, #, $, %, ^, &, , *, (, )) and returns the new string. The only non-alphanumeric characters allowed are dashes -, underscores _ and spaces. I’m new at this so I understand that this code may be… Read More How do I create a function in javascript that only allows letters, numbers, dashes -, underscores _ and spaces?