Finding and removing Non-ASCII characters from an Oracle Varchar2
I think this will do the trick: SELECT REGEXP_REPLACE(COLUMN, ‘[^[:print:]]’, ”)
I think this will do the trick: SELECT REGEXP_REPLACE(COLUMN, ‘[^[:print:]]’, ”)
Java 11 and later str = “*”.repeat(str.length()); Note: This replaces newlines \n with *. If you want to preserve \n, see solution below. Java 10 and earlier str = str.replaceAll(“.”, “*”); This preserves newlines. To replace newlines with * as well in Java 10 and earlier, you can use: str = str.replaceAll(“(?s).”, “*”); The (?s) … Read more
Try this \b(0*(?:[1-9][0-9]?|100))\b Explanation ” \b # Assert position at a word boundary ( # Match the regular expression below and capture its match into backreference number 1 0 # Match the character “0” literally * # Between zero and unlimited times, as many times as possible, giving back as needed (greedy) (?: # Match … Read more
For non greedy match, try this <TD.*?>
Try the following: \w+(?:\.\w+)+ The + after (?: … ) tell it to match what is inside the parenthesis one or more times. Note that \w only matches ASCII characters, so a word like café wouldn’t be matches by \w+, let alone words/text containing Unicode. EDIT The difference between […] and (?:…) is that […] … Read more
^\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$ From the fine folks over at Zorched. ^: anchored to beginning of string \S*: any set of characters (?=\S{8,}): of at least length 8 (?=\S*[a-z]): containing at least one lowercase letter (?=\S*[A-Z]): and at least one uppercase letter (?=\S*[\d]): and at least one number $: anchored to the end of the string To include … Read more
Directory.GetFiles doesn’t support RegEx by default, what you can do is to filter by RegEx on your file list. Take a look at this listing: Regex reg = new Regex(@”^^(?!p_|t_).*”); var files = Directory.GetFiles(yourPath, “*.png; *.jpg; *.gif”) .Where(path => reg.IsMatch(path)) .ToList();
If you also want to remove lines that only contain whitespace, use resultString = Regex.Replace(subjectString, @”^\s+$[\r\n]*”, string.Empty, RegexOptions.Multiline); ^\s+$ will remove everything from the first blank line to the last (in a contiguous block of empty lines), including lines that only contain tabs or spaces. [\r\n]* will then remove the last CRLF (or just LF … Read more
\r is “Carriage Return” (CR, ASCII character 13), \n is “Line Feed” (LF, ASCII character 10). Back in the days, you had two ASCII characters at the end of each line to tell a printer what to do – CR would tell the printer to go back to the left edge of the paper, LF … Read more
There is no API in Java to obtain the names of the named capturing groups. I think this is a missing feature. The easy way out is to pick out candidate named capturing groups from the pattern, then try to access the named group from the match. In other words, you don’t know the exact … Read more