Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Introduction

The Power Search Bar is an indispensable tool that enables users to locate source text and translations through the application of regular expressions and wildcards. While this feature offers a robust and flexible search experience, it's crucial to be aware that not all operators are supported.

Regular Expressions (Regex)

Standard operators

Regular expressions utilize placeholder characters, referred to as operators, to match patterns within data and text. Wordbee’s library supports all Unicode characters but reserves some of them to be regex operators:

" . ? + * \ { } | ( ) [ ] ^ 

" If you include a double quotation mark in your regular expression pattern, it is used to match the exact occurrence of that character in the text you are searching. For example:

"example" will match the word 'example'

. Matches any character. For example:

ab.     will match 'aba', 'abb', 'abz', etc.

? Indicates that the preceding character is repeated zero or one times. Often used to make the preceding character optional. For example:

abc?     will match 'ab' and 'abc'

+ Indicates that the preceding character is repeated one or more times. For example:

ab+     will match 'ab', 'abb', 'abbb', etc.

* Indicates that the preceding character is repeated zero or more times. For example:

ab*     will match 'a', 'ab', 'abb', 'abbb', etc.

\ A backslash is used as an escape character to indicate that the character following it should be treated as a literal character and not a regex operator.

\.     will match '.' instead of any character (see above)

{} In braces users can define the minimum and maximum number of times the preceding character can repeat. For example:

a{2}    will match 'aa'
a{2,4}  will match 'aa', 'aaa', and 'aaaa'
a{2,}   will match 'a` repeated two or more times

| OR operator. The match will succeed if the longest pattern on either the left side OR the right side matches. For example:

abc|xyz  will match 'abc' and 'xyz'

( … ) Parantheses can be used to form groups within regular expressions. You can use a group to treat part of the expression as a single character. For example:

abc(def)?  will match 'abc' and 'abcdef' but not 'abcd'

[ … ] Brackets are used to match one of the characters within them.
Inside brackets, - indicates a range unless - is the first character or escaped. For example:

[abc]   will match 'a', 'b', 'c'
[a-c]   will match 'a', 'b', or 'c'
[-abc]  will match '-', 'a', 'b', or 'c'
[abc\-] escapes '-' and will match 'a', 'b', 'c', or '-'

A ^ before a character in the brackets negates the character or range. For example:

[^abc]      will match any character except 'a', 'b', or 'c'
[^a-c]      will match any character except 'a', 'b', or 'c'
[^-abc]     will match any character except '-', 'a', 'b', or 'c'
[^abc\-]    will match any character except 'a', 'b', 'c', or '-'
  • No labels