Belkasoft X Help Contents
Regular expression syntax
Below is the table of the most commonly used characters, with their meanings and examples.
Regular expression | Explanation | Example | Matching |
---|---|---|---|
. | Any single character excluding a newline | .ar | The car parked in the garage |
[ ] | Searches for any of the characters in parentheses. | [Tt]he | The car parked in the garage |
[a-z] | A dash means a range of characters | [e-g] | The seller sold 2 guns and 7 pistols. |
[0-9] | Finds any digit between 0 and 9 | [3-8] | The seller sold 2 guns and 7 pistols. |
[^ ] | Matches any character that is not contained between the square brackets | [^c]ar | The car parked in the garage. |
\. | A dot matches almost any character, use \ symbol to find a regular dot | ar\. | A garage is a good place to park a car. |
| | The pipe symbol "|" acts as an OR operator | gr[e|a]y | grey, gray |
{m} | Repeat exactly m times | colou{3}r | colouuur |
{m,n} | Repeat from m to n times | colou{2,4}r | colouur, colouuur, colouuuur |
{m,} | Repeat at least m times | colou{2,}r | colouur, colouuur, colouuuur, etc. |
{,n} | Repeat not less n times | colou{,3}r | color, colour, colouur, colouuur |
? | Makes the preceding character optional. Matches zero or one times: corresponding {0,1} | colou?r | color, colour |
* | Repeat zero-or-more times: corresponding {0,} | colou*r | color, colour, colouur, etc. |
+ | Repeat once or more times: corresponding {1,} | colou+r | colour, colouur, etc (but not color) |
^ | Finds the beginning of the entered string | ^a | aaa aaa |
x$ | A line ending with the x | a$ | aaa aaa |
(xyz) | Finds a group of characters in a strictly specified order. | (at) | Fat cat is going to Staten Island |
\ | Cancel the special meaning of the metacharacter that follows it. Allows searching for service characters [] () {}. * +? ^ $ \ | | (f|c|m)at\.? | The fat cat sat on the mat. |
\s | Space | \s*cat\s* | The fat cat sat on the concatenation. |
/^Yes/ | A line starting with Yes | /^Yes/ | Yes ... Yesterday ... |
/th/ | Occurrence of the string th anywhere in a word | /th/ | the, there, path, bathing, etc. |
Example: how to find artifacts like 123-1234 with any number? Use this regular expression: [0-9]{3}-[0-9]{4}.
See also:
Searching artifacts
Search Results window
Automatic searches