Added regular expressions tutorial. Because serpentine failed me :(

actorid
Marek Kochanowicz 11 years ago
parent 470616ce92
commit 1eaca1e26b

@ -70,8 +70,15 @@ This is probably enough to create around 90\% string filters you will eventually
\\
Creating regexps can be a difficult and annoying -- especially when you need complex criteria. On the other hand, We are under impression that in reality complex expressions are needed only in sporadic cases. In fact, the truth is: that most of the time only already mentioned ``.*'' is needed and therefore the following description of regexps can be skipped by vast majority of readers.\\
%TO-DO: write the regexps essentials.
Regular expressions are not the main topic of this manual. If you wish to learn more on this subject please, read the documentation on Qt regular expressions syntax, or TRE regexp syntax (it is almost like in Qt).
Before working with Regular Expressions, you should understand what actually are regular expressions. Essentially, the idea is simple: when you are writing any word, you are using strictly defined latters -- that is: latters create a word. What you want to do with regular expression is to use set of rules that will match to many words. It is not that difficult to see what it's needed to do so: first, you will clearly need way to determinate what latters you want to match (word is composed by latters).\\
Before introducing other ways to choose between characters, I want explain anchors. Anchors allows you to decide where to ``look'' in the string. You surely should know about ``^'' anchor and ``\$''. Putting ``^`` will tell to Open{CS} to look on the beginning of string, while ''\$`` is used to mark the end of it. For instance, pattern ''^Pink.* elephant.\$`` Will match any sentence Beginning with the word ''Pink`` and ending with '' elephant.``. Pink fat elephant. Pink cute elephant. It doe not matter what is in between because ''.*`` is used.\\
You have already seen the power of the simple ``.*''. But what if you want to chose between only two (or more) latters? Well, this is when ``[|]'' comes in handy. If you write something like: ``^[a|k].*'' you are simply telling Open{CS} to filter anything that starts with either ``a'' or ``k''. Using ``^[a|k|l].*'' will work in the same manner, but it will also cover strings starting with ``l''.\\
And What if you want to match more than just one latter, just use ``(|)`` it is pretty similar to the above, but it is used to fit more than just one character. For instance: ''^(Pink|Green).* (elephant|crocodile).\$`` will be true for all sentences starting with ''Pink`` or ''Green`` and ending with either ''elephant.`` or ''crocodile.``.\\
Regular expressions are not the main topic of this manual. If you wish to learn more on this subject please, read the documentation on Qt regular expressions syntax, or TRE regexp syntax (it is almost like in Qt). Above is just enough to use Open{CS} effectively to be sure.
\paragraph{Value -- value(``value'', (``open'', ``close''))}
While string expression covers vast group of columns containing string values, there are in fact columns with just numerical values like ``weight``. To filter those we need a value expression. This one works in similar manner to the string filter: first token name and criteria inside brackets. Clearly, conditions should hold column to test in. However in this case wanted value is specified as a range.\\

Loading…
Cancel
Save