Regex: ignore case sensitivity

Assuming you want the whole regex to ignore case, you should look for the i flag. Nearly all regex engines support it: Check the documentation for your language/platform/tool to find how the matching modes are specified. If you want only part of the regex to be case insensitive (as my original answer presumed), then you … Read more

regex match any whitespace

Your regex should work ‘as-is’. Assuming that it is doing what you want it to. This means match wordA followed by 0 or more spaces followed by wordB, but do not match if followed by wordc. Note the single space between ?! and wordc which means that wordA wordB wordc will not match, but wordA wordB wordc will. Here are some example matches and the associated replacement output: Note … Read more

Difference between \b and \B in regex

The confusion stems from your thinking \b matches spaces (probably because “b” suggests “blank”). \b matches the empty string at the beginning or end of a word. \B matches the empty string not at the beginning or end of a word. The key here is that “-” is not a part of a word. So … Read more

Regex not operator

No, there’s no direct not operator. At least not the way you hope for. You can use a zero-width negative lookahead, however: The (?!…) part means “only match if the text following (hence: lookahead) this doesn’t (hence: negative) match this. But it doesn’t actually consume the characters it matches (hence: zero-width). There are actually 4 … Read more

Matching a space in regex

If you’re looking for a space, that would be ” ” (one space). If you’re looking for one or more, it’s ” *” (that’s two spaces and an asterisk) or ” +” (one space and a plus). If you’re looking for common spacing, use “[ X]” or “[ X][ X]*” or “[ X]+” where X … Read more

Javascript split regex question

You need the put the characters you wish to split on in a character class, which tells the regular expression engine “any of these characters is a match”. For your purposes, this would look like: Although dashes have special meaning in character classes as a range specifier (ie [a-z] means the same as [abcdefghijklmnopqrstuvwxyz]), if you put it as … Read more

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