SKTools®    4.x
©2002-2009, SKKV Software
E-mail: info@s-k-tools.com
http://www.s-k-tools.com
| Any character except [\^$.|?*+() | All characters except the listed special characters match a single instance of themselves. { and } are literal characters, unless they're part of a valid regular expression token (e.g. the {n} quantifier). |
| \ (backslash) followed by any of [\^$.|?*+(){}] | A backslash escapes special characters to suppress their special meaning. |
| \xFF where FF are 2 hexadecimal digits | Matches the character with the specified ASCII/ANSI value, which depends on the code page used. Can be used in character classes. |
| \n, \r and \t | Match an LF character, CR character and a tab character respectively. Can be used in character classes. |
| [ (opening square bracket) | Starts a character class. A character class matches a single character out of all the possibilities offered by the character class. Inside a character class, different rules apply. The rules in this section are only valid inside character classes. The rules outside this section are not valid in character classes, except \n, \r, \t and \xFF |
| Any character except |
All characters except the listed special characters add that character to the possible matches for the character class. |
| - (hyphen) except immediately after the opening [ | Specifies a range of characters. (Specifies a hyphen if placed immediately after the opening [) |
| ^ (caret) immediately after the opening [ | Negates the character class, causing it to match a single character not listed in the character class. (Specifies a caret if placed anywhere except after the opening [) |
| \d, \w and \s | Shorthand character classes matching digits 0-9, word characters (letters and digits) and whitespace respectively. Can be used inside and outside character classes. |
| \D, \W and \S | Negated versions of the above. Should be used only outside character classes. (Can be used inside, but that is confusing.) |
| . (dot) | Matches any single character except line break characters \r and \n. |
| ^ (caret) | Matches at the start of the string the regex pattern is applied to. |
| $ (dollar) | Matches at the end of the string the regex pattern is applied to. |
| | (pipe) | Causes the regex engine to match either the part on the left side, or the part on the right side. Can be strung together into a series of options. The pipe has the lowest precedence of all operators. Use grouping to alternate only part of the regular expression. |
| ? (question mark) | Makes the preceding item optional. Greedy, so the optional item is included in the match if possible. |
| ?? | Makes the preceding item optional. Lazy, so the optional item is excluded in the match if possible. This construct is often excluded from documentation because of its limited use. |
| * (star) | Repeats the previous item zero or more times. Greedy, so as many items as possible will be matched before trying permutations with less matches of the preceding item, up to the point where the preceding item is not matched at all. |
| *? (lazy star) | Repeats the previous item zero or more times. Lazy, so the engine first attempts to skip the previous item, before trying permutations with ever increasing matches of the preceding item. |
| + (plus) | Repeats the previous item once or more. Greedy, so as many items as possible will be matched before trying permutations with less matches of the preceding item, up to the point where the preceding item is matched only once. |
| +? (lazy plus) | Repeats the previous item once or more. Lazy, so the engine first matches the previous item only once, before trying permutations with ever increasing matches of the preceding item. |
| {n} where n is an integer >= 1 | Repeats the previous item exactly n times. |
| {n,m} where n >= 0 and m >= n | Repeats the previous item between n and m times. Greedy, so repeating m times is tried before reducing the repetition to n times. |
| {n,m}? where n >= 0 and m >= n | Repeats the previous item between n and m times. Lazy, so repeating n times is tried before increasing the repetition to m times. |
| {n,} where n >= 0 | Repeats the previous item at least n times. Greedy, so as many items as possible will be matched before trying permutations with less matches of the preceding item, up to the point where the preceding item is matched only n times. |
| {n,}? where n >= 0 | Repeats the previous item n or more times. Lazy, so the engine first matches the previous item n times, before trying permutations with ever increasing matches of the preceding item. |
| (regex) | Round brackets group the regex between them. They capture the text matched by the regex inside them that can be reused in a backreference, and they allow you to apply regex operators to the entire grouped regex. |
| \1 through \9 | Substituted with the text matched between the 1st through 9th pair of capturing parentheses. |
| .+[.].+ | Same as *.* without regular expressions |
| (.+)([.])(.+) |
Same but make groups: for file name test.txt \1 it is «test» \2 it.is «.» \3 it is «txt» |
| ^[^/\:*?"<>|]+[.][^/\:*?"<>|]+$ | Find (as example in registry) values which can be file names like “name.ext”. Note: characters “/\:*?"<>|” is illegal in file names. |
| ^[0-9]{1,25}$ | Find values which length from 1 to 25 characters. All characters will be digits. |
| ^[\w]{10}$ | Find values which length 10 characters |
|
Search string: ^([+]7|8)[(]*095[)]*([0-9]{7})$ Replacement string: +7(495)\2 |
Need replace city code in phone numbers.
Example source numbers: +70951234567, 8(095)1234568 etc. new city code is 495. After replacement numbers will be: +7(495)1234567 +7(495)1234568 |
|
Search string: (.+[.])(jpeg) Replacement string: \1jpg |
Find *.jpeg files and rename to *.jpg |
|
Search string: ([^_]+)([_])([0-9]+)([.])(.+) Replacement string: \3\2\1\4\5 |
Find files like Music_01.mp3 and rename to 01_Music.mp3 |
| ([mMtT])(.+)([0-9])([.])(.+) | Find files which have in name as first character a letter «m» or «t» and as last character a digit (0-9). |
| ^[a-z0-9_-]{1,20}@(([a-z0-9-]+\.)+(com|net|org|mil|edu|gov|arpa|info|biz|inc|name|[a-z]{2})|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$ | Find (in registry) values which is e-mail address |
| [a-z0-9_-]{1,20}@(([a-z0-9-]+\.)+(com|net|org|mil|edu|gov|arpa|info|biz|inc|name|[a-z]{2})|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) | Find (in registry) values which contain e-mail address |