Remove punctuation from string with Regex

First, please read here for information on regular expressions. It’s worth learning. You can use this: Regex.Replace(“This is a test string, with lots of: punctuations; in it?!.”, @”[^\w\s]”, “”); Which means: [ #Character block start. ^ #Not these characters (letters, numbers). \w #Word characters. \s #Space characters. ] #Character block end. In the end it … Read more

Best way to strip punctuation from a string

From an efficiency perspective, you’re not going to beat s.translate(None, string.punctuation) For higher versions of Python use the following code: s.translate(str.maketrans(”, ”, string.punctuation)) It’s performing raw string operations in C with a lookup table – there’s not much that will beat that but writing your own C code. If speed isn’t a worry, another option … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)